You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by angelochen <an...@yahoo.com.hk> on 2011/12/02 00:21:09 UTC

onValidate in T5.2.6

hi,

to uprade to 5.3, we need to replace all onValidateForm to onValidate, but
does onValidate works in 5.2.6?
Thanks,

--
View this message in context: http://tapestry.1045711.n5.nabble.com/onValidate-in-T5-2-6-tp5040192p5040192.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Correct.

And it still is best practice!

On 2 December 2011 18:38, angelochen <an...@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 <an...@.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 <an...@.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
>>>>>>> <an...@.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
>>>>>>>>> <an...@.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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by angelochen <an...@yahoo.com.hk>.
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 &lt;angelochen960@.com&gt; 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 &lt;angelochen960@.com&gt; 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
>>>>> &lt;do.not.eat.yellow.snow@&gt; 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
>>>>>> &lt;angelochen960@.com&gt;
>>>>>> 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
>>>>>>>> &lt;angelochen960@.com&gt;
>>>>>>>>
>>>>>>>> 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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Steve Eynon <st...@alienfactory.co.uk>.
> 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 <an...@yahoo.com.hk> 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 <an...@.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
>>>>> <an...@.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
>>>>>>> <an...@.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@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by angelochen <an...@yahoo.com.hk>.
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 &lt;angelochen960@.com&gt; 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
>>> &lt;do.not.eat.yellow.snow@&gt; 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
>>>> &lt;angelochen960@.com&gt;
>>>> 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
>>>>>> &lt;angelochen960@.com&gt;
>>>>>>
>>>>>> 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@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Steve Eynon <st...@alienfactory.co.uk>.
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 <an...@yahoo.com.hk> 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 <an...@.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
>>>>> <an...@.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@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by angelochen <an...@yahoo.com.hk>.
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
> &lt;do.not.eat.yellow.snow@&gt; 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 &lt;angelochen960@.com&gt;
>> 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
>>>> &lt;angelochen960@.com&gt;
>>>>
>>>> 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@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Steve Eynon <st...@alienfactory.co.uk>.
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...@gmail.com> 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 <an...@yahoo.com.hk>
> 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 &lt;angelochen960@.com&gt;
>>>
>>> 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@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Martin Strand <do...@gmail.com>.
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 <an...@yahoo.com.hk> 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 &lt;angelochen960@.com&gt;
>> 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@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by angelochen <an...@yahoo.com.hk>.
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 &lt;angelochen960@.com&gt;
> 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
> 


--
View this message in context: http://tapestry.1045711.n5.nabble.com/onValidate-in-T5-2-6-tp5040192p5040256.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Robert Zeigler <ro...@roxanemy.com>.
I wonder if we could write a code analysis tool that would check for these sorts of things. We have @deprecated for methods and variables, so that works, but when the "adaptive API" changes, it's considerably harder to catch/see. Maybe a find-bugs extension for tapestry upgrades or something?

Robert

On Dec 1, 2011, at 12/15:38 PM , Martin Strand wrote:

> On Fri, 02 Dec 2011 00:21:09 +0100, angelochen <an...@yahoo.com.hk> 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@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: onValidate in T5.2.6

Posted by Martin Strand <do...@gmail.com>.
On Fri, 02 Dec 2011 00:21:09 +0100, angelochen <an...@yahoo.com.hk> 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@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org