One option is to override Form.process() and compare findSubmittingButton() against your various buttons, then bypass the super method if you don't want it to update your model (just return true). Until wicket has some better way to bypass the model update, this works just fine.

Nathan

Matej Knopp wrote:
Hi.

I know this has been discussed already, but still I'm opening it once more. I think there should be a way to preserve form state without validation and model updating.

The use case is following.
I have a (complex) form with some fields, that can not be entered directly, i.e. they have to be selected on other page. So I need to move between pages, but I don't want to lose any information entered on the previous page. If I use Button, the form gets processed, validated, etc and the action won't execute unless all entered data is valid. If I turn defaultProcessing off, the action executes, but the data (not written to model yet) is lost.

What I'm using now is little hacky, but it works. I have my own class derived from Form, my own SubmitButton, ImmediateButton and FeedbackPanel. ImmediateButton acts like classic Button with defaultFormProcessing turned off, but unlike it, ImmediateButton stores the state in each component (in the string reserved for invalid data). So there's my own Feedback panel (Although filter would be probably enough) that detects that ImmediateButton was clicked and hides validation messages (there's a lot of them, because ImmediateButton marks every component as invalid).

This approach works pretty well, but doesn't feel quite right. I think there definitely should be a way to preserve form state (without validation and updating model) directly supported by wicket. Not to mention that (if I recall correctly) the string field in FormComponent used for storing invalid data is transient.

Btw. I've managed to persuade people from my company to use wicket for one of our projects. Since I do most of the current development, it's not a big deal, because I've personally been using wicket for some time now. But I can say they are really impressed with the productivity and simplicity of certain actions (like moving between complex pages forth and back ;) - that are sometimes quite difficult and cumbersome in struts. Not to mention excellent DataView and DatePicker components, markup inheritance and compoents in general.

Kudos wicket team, you're doing excelent work!

Sorry for really long mail,

-Matej


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php



-------------------------------------------------------
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_id=7628&alloc_id=16845&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to