ok then if there are buttons don't call form.onSubmit() ? But only call the buttons submit..

And still give the button a property what the submit should do (validate or not)
That seems to be as the cleanest way.


johan


Eelco Hillenius wrote:

But that means the submit button allways have to be a real component. A lot of times I just use <input type="submit".. instead of making this a Wicket component, and I am quite happy with that. Furthermore, you will have problems with form submits that are triggered by Javascript.

Eelco

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



-------------------------------------------------------
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

Reply via email to