[Moving a private email to dev@ as it's really where it should be discussed]

Luca Garulli wrote:

Hi,
my customer want a minimal client-side validation for same fields. We
are using CForms and seems to be lack of this feature.

I'd like to have a single place where to describe validation rules:
the form definition. Anyone has implemented something like a
client-side validation that use the form-definition rules?

If not I can start to write it. I think that it's a common use case.



Yes, that's a common use case and we already talked about it but never got the time to implement it.


There are different kinds of client-side validation
- field presence for required fields
- datatype syntax : integer, date, taking the locale-dependent format into account
- additional validations.


The first item should be easy, and the second one can leverage the datatype information that is already present in a field's XML output (used e.g. to trigger the use of the calendar widget)

The third one is trickier, as some validation rules can be controlled on the client (e.g. range, regexp) whereas others can't. What we can do here is adding a generateSAXFragment to validation rules also, so that those rule that can be implemented on the client can produce an XML description that will be translated to JavaScript by the presentation stylesheets.

WDYT?

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to