You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tony Nelson <tn...@starpoint.com> on 2011/06/25 23:29:21 UTC

TAP5.3.0 onValidate

I saw in the release notes that onValidateForm has been replaced by onValidate.  Should it be called 2x on form post?

[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onPrepare()
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onPrepare
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
[1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onSuccess()

Previously I used the onValidateForm method to save my business objects and onSuccess() to redirect to the next page.

What strategy should be used to convert from onValidateForm() to onValidate() ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TAP5.3.0 onValidate

Posted by Taha Hafeez <ta...@gmail.com>.
onValidateFromUserName() can be used for adding custom validation for
userName. This event "validate" for a field is triggered when the value is
available for the that particular field and "validate" for form is triggered
when the value is available for all fields in that form.

So, if I have to ensure the userName  is unique, i can validate it in
onValidateFromUserName(), but if I have to ensure userName and password
match I can validate in onValidateFromForm()

regards
Taha


On Sun, Jun 26, 2011 at 5:03 AM, Tony Nelson <tn...@starpoint.com> wrote:

> On Jun 25, 2011, at 7:12 PM, Taha Tapestry wrote:
>
> > Hi Tony
> >
> > If your form's name is myForm then You should call
> onValidateFromMyForm(). If you do not append "FromMyForm" then the method "
> onValidate" will be called for each form field as well as  for the form
> itself.
> >
> > Other alternative is to name the method anything else and annotate with
> @OnEvent annotation and specify the event source
> >
>
> Thank you very much.  I'm just getting back into Tapestry (I have used 3 &
> 4) and I'm having a little trouble with the event model.
>
> So in 5.3.0 if I have a text field called userName, I could provide and
>
> onValidateFromUserName to provide validation for that field
>
> and
>
> onValidateFromMyForm to do multi field and other business rule (ie, unique
> column) rules
>
> I'm sure there is a value to calling onValidate() for each field, but I'm
> certainly struggling to imagine a use case.
>
> Thanks again.
>
> Tony
>
> > Regards
> > Taha
> >
> > On Jun 26, 2011, at 2:59 AM, Tony Nelson <tn...@starpoint.com> wrote:
> >
> >> I saw in the release notes that onValidateForm has been replaced by
> onValidate.  Should it be called 2x on form post?
> >>
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onPrepare()
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onPrepare
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
> >> [1106760625@qtp-1806030550-8] DEBUG
> com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onSuccess()
> >>
> >> Previously I used the onValidateForm method to save my business objects
> and onSuccess() to redirect to the next page.
> >>
> >> What strategy should be used to convert from onValidateForm() to
> onValidate() ?
> >> ---------------------------------------------------------------------
> >> 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
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: TAP5.3.0 onValidate

Posted by Tony Nelson <tn...@starpoint.com>.
On Jun 25, 2011, at 7:12 PM, Taha Tapestry wrote:

> Hi Tony
> 
> If your form's name is myForm then You should call onValidateFromMyForm(). If you do not append "FromMyForm" then the method " onValidate" will be called for each form field as well as  for the form itself.
> 
> Other alternative is to name the method anything else and annotate with @OnEvent annotation and specify the event source
> 

Thank you very much.  I'm just getting back into Tapestry (I have used 3 & 4) and I'm having a little trouble with the event model.

So in 5.3.0 if I have a text field called userName, I could provide and

onValidateFromUserName to provide validation for that field

and

onValidateFromMyForm to do multi field and other business rule (ie, unique column) rules

I'm sure there is a value to calling onValidate() for each field, but I'm certainly struggling to imagine a use case.

Thanks again.

Tony

> Regards
> Taha 
> 
> On Jun 26, 2011, at 2:59 AM, Tony Nelson <tn...@starpoint.com> wrote:
> 
>> I saw in the release notes that onValidateForm has been replaced by onValidate.  Should it be called 2x on form post?
>> 
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onPrepare()
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onPrepare
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
>> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onSuccess()
>> 
>> Previously I used the onValidateForm method to save my business objects and onSuccess() to redirect to the next page.
>> 
>> What strategy should be used to convert from onValidateForm() to onValidate() ?
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: TAP5.3.0 onValidate

Posted by Taha Tapestry <ta...@gmail.com>.
Hi Tony

If your form's name is myForm then You should call onValidateFromMyForm(). If you do not append "FromMyForm" then the method " onValidate" will be called for each form field as well as  for the form itself.
 
Other alternative is to name the method anything else and annotate with @OnEvent annotation and specify the event source

Regards
Taha 

On Jun 26, 2011, at 2:59 AM, Tony Nelson <tn...@starpoint.com> wrote:

> I saw in the release notes that onValidateForm has been replaced by onValidate.  Should it be called 2x on form post?
> 
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onPrepare()
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onPrepare
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onValidate()
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ EXIT] onValidate
> [1106760625@qtp-1806030550-8] DEBUG com.starpoint.helpdesk.pages.group.EditGroup  - [ENTER] onSuccess()
> 
> Previously I used the onValidateForm method to save my business objects and onSuccess() to redirect to the next page.
> 
> What strategy should be used to convert from onValidateForm() to onValidate() ?
> ---------------------------------------------------------------------
> 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