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.

                       -0-


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.

                       -0-

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.


Regards,

-=Ivelin=-




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to