As you know, when generating an application using some Tamino Schema field edits are not included. For instance, when generating an app from a schema whose document contains interger fields, X-Application just treats these as text fields. So when you go to create a document instance via the Create.jsp page and the doc contains an interger element say zip code, a Tamino Java API error is thrown upon incorrect data entry (such as entering text or null). It would be nice if field edits where generated automatically when initially creating the application. Can anybody give me any hints on how to do this. Code examples welcome.
Thanks in Advance
Hello Shane,
we discussed this topic. Our approach was to put some JavaScript-Code into the JSP Page which checks the content of an input field. If the format of the content is invalid, the form is not sent and the user gets a message about the error.
We had also the idea to implement this approach by our generator, but we had not the resources to do that for the version 3.1.1.
If you are interested in this feature, I could roughly explain what steps were required:
(1) A JavaScript library is required which contains the check functionality. Perhaps, there are some existing free libraries on the Web.
(2) The structure.xml file of the generator extends the ?input? element by an additional attribute ?type?, e.g.
(3) The XSLT files which translate the structure file into the JSP pages create the check function which is invoked when the form is sent. It is also possible that the HTML input fields depend on the type information, e.g. for Boolean values it could create a check-box.
The XSLT files of the generator can be found in the directory
%XAPPLICATION_HOME%\template\xsl
(4) The source code of the Generator has to be changed for the additional type information is added to the structure file: the methods
(a) processContentNode
(b) processAttributeNode
of the classes BreadthFirstSearchProcessor and DepthFirstSchemaProcessor must extract the type information from the schema definition. The schema definition is the parameter ?elem? of these methods. It is a DOM node which contains the element definition of a content / attribute node.
If you need more assistance for this topic, make a post reply to the current topic.
Good luck,
Christian.