Re: How to hook component into validation?

2010-03-19 Thread Michael Prescott
Joost, thanks for your help.

Michael

On Wed, Mar 17, 2010 at 8:27 PM, Joost Schouten (ml)
joost...@jsportal.comwrote:

 You can listen for the validation events on the individual form elements of
 your component.

 eg:

 @Enviromental
 private ValidationTracker validationTracker;

 @OnEvent(component = myFormField, value = EventConstants.VALIDATE)
 private void validateFormField(Object valueAboutToBeSet) {
   //do your validation and record errors where needed with the
 validationTracker
 }

 Hope this helps,
 Joost


 Michael Prescott wrote:

 I have a component which is a wrapper around some form fields.  (Imagine
 an
 'edit address' component.)

 If I want to provide some custom validation, is there a way to listen to
 the
 enclosing form's validation event?  The problem is that the form is
 defined
 in the page, not in my component. Right now, the page catches the
 validation
 event and then calls a validate(Form form) method on my component.

 But I'm wondering if there's a way to have my component do this
 automatically, so that future users won't have to remember to hook this
 up.
 (Plus, the page's validation event handler does nothing else, so it's
 kinda
 silly.)

 Any tips greatly appreciated!

 Michael





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




Re: How to hook component into validation?

2010-03-17 Thread Joost Schouten (ml)
You can listen for the validation events on the individual form elements 
of your component.


eg:

@Enviromental
private ValidationTracker validationTracker;

@OnEvent(component = myFormField, value = EventConstants.VALIDATE)
private void validateFormField(Object valueAboutToBeSet) {
   //do your validation and record errors where needed with the 
validationTracker

}

Hope this helps,
Joost

Michael Prescott wrote:

I have a component which is a wrapper around some form fields.  (Imagine an
'edit address' component.)

If I want to provide some custom validation, is there a way to listen to the
enclosing form's validation event?  The problem is that the form is defined
in the page, not in my component. Right now, the page catches the validation
event and then calls a validate(Form form) method on my component.

But I'm wondering if there's a way to have my component do this
automatically, so that future users won't have to remember to hook this up.
(Plus, the page's validation event handler does nothing else, so it's kinda
silly.)

Any tips greatly appreciated!

Michael

  



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