I think most of us would have come across the problem of date validation in XML form builder application. I posted query in SDN as to how to go about this date validation in applications created by XML form builder but with very little response. Here is my blog, which is a simple description of how to handle date validation in the application.
This wiki describes a simple solution to date validation in the application when the save button is clicked. Programmers can come with different solution for the same scenario.
XML form builder provides field validation for mandatory fields, Data Types, Data Lengths and Patterns - Strings. I found date validation is not handled in the XML form builder application.
It is important that you have basic knowledge in XML, XML schema, XML style sheet.
You use a data schema to define XML elements in which the content of your forms is stored. The data schema represents the content structure of your data, and is separate from the structure of your forms.
When an application is build with XML form builder, there are multiple files generated in the KM repository of which data schema and style sheet files (in which we edit the content to enforce date validation) holds important. These files are generated under the /etc/xmlforms folder in the KM repository. The schema and style sheet files for the respective application are found under the name of the application.
For strings, the pattern can be enforced in the schema file
This restricts the application to accept the user entry to just values between 2004 and 2009. Such a kind of pattern validation is not possible for the date field in XML form builder, by which you can restrict the date entry. So it becomes imperative to look at the XSL file for performing the above discussed functionality.
The application has a date field, in which user is not supposed to enter date values less than the current date. To enforce this requirement, I have edited the XSL file.
As said above, I have handled a simple date validation in my application for demonstration. Programmers can come with a multiple ways to handle this functionality in their own style.