Correct. And it still is best practice!
On 2 December 2011 18:38, angelochen <angelochen...@yahoo.com.hk> wrote: > I see, so the best practice should have been: > > onValidateFromID > > avoid using onValidate > > right? > > > Steve Eynon wrote >> >>> So actually onValidate behave differently in 5.2.6 and 5.3? >> >> No, onValidate() behaves the same in both T5.2.6 and T5.3, but T5.2.6 >> *also* fired an onValidateForm() event. >> >> Steve. >> >> >> On 2 December 2011 13:40, angelochen <angelochen960@.com> wrote: >>> Hi, >>> >>> So actually onValidate behave differently in 5.2.6 and 5.3? >>> >>> >>> Steve Eynon wrote >>>> >>>> That would have worked in T5.2.6 (but no longer in T5.3) >>>> >>>> In T5.2.6 onValidateForm() was called once per form, so if your page >>>> had one form it was called once. But if your page had many forms then >>>> it was called many times (once per form) which meant you had to be >>>> more specific and append the form ID to make onValidateFormFromID(). >>>> >>>> So the quick guide to updating is >>>> >>>> onValidateForm() --> onValidateFromID() >>>> onValidateFormFromID() --> onValidateFromID() >>>> >>>> And that works everywhere, both in T5.2.6 and in T5.3. >>>> >>>> Steve. >>>> >>>> >>>> >>>> On 2 December 2011 13:07, angelochen <angelochen960@.com> wrote: >>>>> I have a lot of onValidateForm, and also onValidateFormFromID, can not >>>>> remember why, seems to me I applied this rule: >>>>> >>>>> 1) if only one form in a page, I use onValidateForm >>>>> 2) if more than a form in a page, I use onValidateFormFromID >>>>> >>>>> is this right approach? thanks, >>>>> >>>>> Angelo >>>>> >>>>> >>>>> Steve Eynon wrote >>>>>> >>>>>> Make sure you include the form name in the event handler. e.g. >>>>>> >>>>>> <t:form t:id="angryCows" > >>>>>> >>>>>> your new method would be: >>>>>> >>>>>> void onValidateFromAngryCows() { >>>>>> ... >>>>>> } >>>>>> >>>>>> because a barebones >>>>>> >>>>>> void onValidate() { >>>>>> ... >>>>>> } >>>>>> >>>>>> gets called for the form *and* for every component in the form - which >>>>>> you probably don't want! >>>>>> >>>>>> Steve. >>>>>> >>>>>> -- >>>>>> Steve Eynon >>>>>> ------------------------------- >>>>>> "If at first you don't succeed, >>>>>> so much for skydiving!" >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 2 December 2011 08:41, Martin Strand >>>>>> <do.not.eat.yellow.snow@> wrote: >>>>>>> Yes, they work the same. The new "validate" event is fired just >>>>>>> before >>>>>>> the >>>>>>> deprecated "validateForm" and is meant to replace the old event. >>>>>>> Having both events in 5.2 is simply a way to rename the event while >>>>>>> retaining backwards compatibility. >>>>>>> >>>>>>> >>>>>>> On Fri, 02 Dec 2011 01:17:13 +0100, angelochen >>>>>>> <angelochen960@.com> >>>>>>> wrote: >>>>>>> >>>>>>>> Thanks, does it work the same? what my approach will be, replace all >>>>>>>> 'onValidateForm' with 'onValidate' first in 5.2.6, and later upgrade >>>>>>>> to >>>>>>>> 5.3. >>>>>>>> >>>>>>>> >>>>>>>> Martin Strand-4 wrote >>>>>>>>> >>>>>>>>> >>>>>>>>> On Fri, 02 Dec 2011 00:21:09 +0100, angelochen >>>>>>>>> <angelochen960@.com> >>>>>>>>> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> hi, >>>>>>>>>> >>>>>>>>>> to uprade to 5.3, we need to replace all onValidateForm to >>>>>>>>>> onValidate, >>>>>>>>>> but >>>>>>>>>> does onValidate works in 5.2.6? >>>>>>>>> >>>>>>>>> >>>>>>>>> Yes, the "validate" event works in Tapestry 5.2.6: >>>>>>>>> >>>>>>>>> http://tapestry.apache.org/5.2/apidocs/org/apache/tapestry5/EventConstants.html#VALIDATE >>>>>>>>> >>>>>>>>> "validateForm" was deprecated in 5.2: >>>>>>>>> >>>>>>>>> http://tapestry.apache.org/5.2/apidocs/org/apache/tapestry5/EventConstants.html#VALIDATE_FORM >>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@.apache >>>>>>> For additional commands, e-mail: users-help@.apache >>>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscribe@.apache >>>>>> For additional commands, e-mail: users-help@.apache >>>>>> >>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://tapestry.1045711.n5.nabble.com/onValidate-in-T5-2-6-tp5040192p5040685.html >>>>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscribe@.apache >>>>> For additional commands, e-mail: users-help@.apache >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscribe@.apache >>>> For additional commands, e-mail: users-help@.apache >>>> >>> >>> >>> -- >>> View this message in context: >>> http://tapestry.1045711.n5.nabble.com/onValidate-in-T5-2-6-tp5040192p5040730.html >>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@.apache >>> For additional commands, e-mail: users-help@.apache >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@.apache >> For additional commands, e-mail: users-help@.apache >> > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/onValidate-in-T5-2-6-tp5040192p5041393.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org