cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivelin Ivanov" <>
Subject [Ann] XMLForm automatic check-box handling
Date Sun, 27 Oct 2002 15:40:55 GMT

The new version of XMLForm checked in CVS HEAD (C2.1),
implements behind the scenes logic to help with
client languages which do not send values for some input fields.

The typical example is HTML's checkbox.

When it is unchecked, the browser won't send anything,
which leaves the app server to handle.
Writing custom code on a case by case basis is certainly tedious and error
prone process.


Several solutions have been discussed over time, and I have finally took a
shot at it.

The implementation is relatively simple.
The XMLFormTransformer saves in the session all the input field references
to model properties, which were rendered in the original document. The
entries are saved under the key of the form view.
When the form is submitted, the populator extracts all the "expected" fields
and matches them with the request.
The ones which are not available, are replaced with default values.
For SelectBoolean, the default value is 'false'.
For SelectMany, the default value is empty collection(or array).
For all the others, the default value is empty string.


The FeedbackWizard sample is modified. It no longer includes code which
reset values for check-box fields.

Notice that only session scope forms can benefit from this new feature!
Request scope forms cannot take advantage of it.

Thoughts and ideas are welcome.



Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message