i don't think this works. it's too much work for the simple case. also, there may actually be 0 submit buttons (form submit by enter key)!
Johan Compagner wrote:
If it where me then just this happens:
Form.validate() Button.onSubmit()
get rid of the form.onSubmit all together..
If i program in another ui framework then the panel itself where input fields are on also doesn't get a onSubmit...
Now only people get confused where must i do what.. Why is button.onSubmit called on this form of mine but not on that form (if one had >1 button and the other not)
If we don't update the models on those button clicks.. Where does the data go? Is that lost?
One thing i see is a Cancel button. That one shouldn't validate the form..
So maybe we should asked the button that is pressed what to do...
final Button button = findSubmittingButton(); if (button == null) { throw new WicketRuntimeException("Unable to find submitting button"); } else { if(button.mustValidate()) { validate() } button.onSubmit(); }
and default returns true... (it is a get/set property)
johan
1. Form.validate() 2. Form.onSubmit() 3. Button.onSubmit()
and such behavior would be more consistent in some sense, but it would also mean that you couldn't just directly handle a multi-button form submission without validation (and model updating) occurring first.
maybe a better alternative would be to have a Button.onValidate() like the Form.onValidate() with a default implementation that validates the form that the button is attached to? then it would behave the way you're expecting, but still be flexible enough to handle the case where someone wants full control over the submit/validate process...
anyone on the dev team have some thoughts here?
jon
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user