Ok, thanks for this info! I'll have to look into Ajax behaviours in more detail at some point. It all looks really well done and very useful, but I think there's more to it than I originally thought.
Cheers, Dave On Tue, 2007-07-03 at 19:40 +0200, Johan Compagner wrote: > you can use onchange but then you don't have to have a submit button > because after every change your form is submitted. > > On 7/3/07, Igor Vaynberg < [EMAIL PROTECTED]> wrote: > > On 7/3/07, Johan Compagner <[EMAIL PROTECTED]> wrote: > first AjaxFormValidationBehavior doesn't do client > side (javascript) validation. > it calls the server and does this by submitting the > form. > > so if you change the field where you have this > validation on. > And then you directly click a submit button yes it > will be done twice. > first the fields onchange is triggered (or the button > i dont know what the browser sees first) > then the button click. > > so yes you get 2 form submits > > But i don't know where you add that form on and what > onchange you trigger > > because this: > add( new AjaxFormValidatingBehavior( this, > "onchange" ) ); > > seems to me that you add this to a forms onchange? > (because this needs to be a form) > but i guess you mean > > textfield.add ( new AjaxFormValidatingBehavior( this, > "onchange" ) ); > > the problem here is that onchange is fired when the focus is > lost from the field. so if you are on that field and you click > the submit button this will result in two form-submittals that > are very very close to each other. thus the double submit that > you see. you should add validatingbehavior to onkeyup, and > make sure to set a throttle so it doesnt flood your server. > > -igor > > > > > > johan > > > > > > On 7/3/07, David Leangen <[EMAIL PROTECTED]> wrote: > > Hi, Eelco, > > I guess I found why this was happening, but > somehow this doesn't seem > right to me. > > I had been experimenting with adding this > > add( new AjaxFormValidatingBehavior( this, > "onchange" ) ); > > to my RequiredTextField. It never did work for > me, but I thought I'd get > back to it later. > > [When I say "it doesn't work", I mean that > there is no Javascript > validation (which IIUC is what's supposed to > happen).] > > Anyway, when I add this behaviour, onSubmit() > is getting called twice > for some reason, which at least for me is > definitely not the desired > behaviour of my form. > > > Is this the expected behaviour, or is > something wrong? > > > Cheers, > Dave > > > > > > On Mon, 2007-07-02 at 21:51 -0700, Eelco > Hillenius wrote: > > > onSubmit(), and consequently the code I > have in that overridden method, > > > is being called twice. > > > > > > I'm wondering if it's my misunderstanding > of how Wicket works, and this > > > behaviour is intended, or if I somehow > introduced a bug in my code. > > > > > > If this is caused by my error, does > anybody have any hints as to where I > > > can look to find the source of this > method's being called twice? > > > > That should definitively not happen. Can you > tell us again what Wicket > > version you are using, and can you set a > break point in your onSubmit > > method and tell us the trace? > > > > Eelco > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of > DB2 express and take > control of your XML. No limits. Just data. > Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 > express and take > control of your XML. No limits. Just data. Click to > get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and > take > control of your XML. No limits. Just data. Click to get it > now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user