I have been following the discussion from a distance and to me it
seems that all solutions that are proposed are rather 'hackish' and
make things more difficult to understand too.

First of all, let's agree that your use case is not a typical one. We
shouldn't make core adjustements that would make things easier for 5%
but harder for 95% of the cases.

Anyway, I think what you want can be done rather elegant now. Like you
outlined, you should use Button.defaultFormProcessing = false to begin
with. In your onSubmit methods of these buttons, you can manually
trigger validation and/ or model updates (e.g. call
Form.updateFormComponentModels).

The next trick is to use models specifically for your view layer, and
once you're done with your wizard style functionality, combine these
models into something you really need. You won't loose any input this
way.

Finally, regarding complex validations... As soon as you need to do
validations that are dependent on other model properties etc, it is
probably wise to leave the default validation path in Wicket.
IValidators are very useful for simple validations that are 1-1
related to components, but if you need to do more complex things, they
are probably more in your way than any help. If you want to do complex
validations easy, you can do them in onSubmit handler code. If you
want it more cleanely solved, you should incorperate the workings in
your (intermediate) models (and probably have something like onSubmit
calling MyModel.validate() or something).

Anyway, I think that when looking whether we can make things easier
for more complex use cases, we shouldn't be thinking too much about
how we can ease things automagically, but instead focus on flexibility
and - maybe more important as not everyone seems to understand to
current form processing - clarity of form processing and it's possible
interception points.

Eelco


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to