Form clear
Hi! I have an user Form that is posted with AjaxFallbackButton. When the forms gets submitted without error I want to clear the form. How can I reset the form? -- View this message in context: http://www.nabble.com/Form-clear-tp16760778p16760778.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form clear
you have to clear the model of the form(components). so either set a new (empty) model object for the form (in combination with a compoundpropertymodel) or you have to reset the models of the formcomponents somehow one by one... Gerolf On Fri, Apr 18, 2008 at 8:53 AM, Mathias P.W Nilsson [EMAIL PROTECTED] wrote: Hi! I have an user Form that is posted with AjaxFallbackButton. When the forms gets submitted without error I want to clear the form. How can I reset the form? -- View this message in context: http://www.nabble.com/Form-clear-tp16760778p16760778.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form clear
As you should reset the form's model object anyway, you could pass the form to the AjaxRequestTarget e.g. onSubmit(AjaxRequestTarget t) { Object o = getModelObject(); businessLayer.process(o.clone()); o.setFoo(null); o.setBar(null); if (t != null) { t.addComponent(this); } } haven't tested it but should work. maybe you can't set outputmarkupid = true on forms, then you have to put it into a webmarkupcontainer and add the container to the target. regards, Michael Mathias P.W Nilsson wrote: Hi! I have an user Form that is posted with AjaxFallbackButton. When the forms gets submitted without error I want to clear the form. How can I reset the form? - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Form-clear-tp16760778p16761355.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]