Re: T5: query about onValidateForm()

2009-10-21 Thread cordenier christophe
I prefer to use onSuccess method and handle second level validation in
onValidate and onValidateFromXxx method.
I use @Validate for first level validation, and sometime create my own
validator when it's possible.

Regards,
Christophe.

2009/10/21 Newham, Cameron cameron.new...@bl.uk

 Apologies if this is obvious, but I'm getting confused over how and
 where onValidateForm() should be used. I have a page with search fields
 in a form and also a grid for the results.



 Currently I have:



  public void onValidateForm()

  {

if (title == null  issn == null)

{

  searchHoldingsForm.recordError(Please provide a value
 for Title or ISSN);

}

  }



  public void onSubmitFromSearchHoldingsForm()

  {

// perform database access using the form fields...

...





 However, the onSubmit...() will be called even if there is an error. Ok,
 I could use a Boolean and set it in onValidate() and then bail out in
 onSubmit...() if there is an error. Or I suppose I could dispense with
 onValidateForm() altogether and set the error messages directly in
 onSubmit...()  Or perhaps I should keep onValidateForm() and do the DB
 stuff in onSuccess()?



 What is the correct way to proceed and why?












Re: T5: query about onValidateForm()

2009-10-21 Thread Ulrich Stärk
Please read the first paragraph of [1]. In short: submit gets fired regardless of the validation 
outcome, success if validation was successful, failure if not. validateForm is fired after the 
individual field's validate events and allows for cross-field validation.


Uli


[1] 
http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html


Am 21.10.2009 10:29 schrieb Newham, Cameron:

Apologies if this is obvious, but I'm getting confused over how and
where onValidateForm() should be used. I have a page with search fields
in a form and also a grid for the results.

 


Currently I have:

 


  public void onValidateForm()

  {

if (title == null  issn == null)

{

  searchHoldingsForm.recordError(Please provide a value
for Title or ISSN);

}

  }

 


  public void onSubmitFromSearchHoldingsForm()

  {

// perform database access using the form fields...

...

 

 


However, the onSubmit...() will be called even if there is an error. Ok,
I could use a Boolean and set it in onValidate() and then bail out in
onSubmit...() if there is an error. Or I suppose I could dispense with
onValidateForm() altogether and set the error messages directly in
onSubmit...()  Or perhaps I should keep onValidateForm() and do the DB
stuff in onSuccess()?

 


What is the correct way to proceed and why?

 

 

 

 





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



Re: T5: query about onValidateForm()

2009-10-21 Thread Geoff Callender
And you'd be well advised to get in the habit of doing all the work in  
onValidate() because errors occurring in onSuccess() won't display  
properly:


https://issues.apache.org/jira/browse/TAPESTRY-1972

Cheers,

Geoff   

On 21/10/2009, at 7:42 PM, Ulrich Stärk wrote:

Please read the first paragraph of [1]. In short: submit gets fired  
regardless of the validation outcome, success if validation was  
successful, failure if not. validateForm is fired after the  
individual field's validate events and allows for cross-field  
validation.


Uli


[1] 
http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html

Am 21.10.2009 10:29 schrieb Newham, Cameron:

Apologies if this is obvious, but I'm getting confused over how and
where onValidateForm() should be used. I have a page with search  
fields

in a form and also a grid for the results.
Currently I have:
  public void onValidateForm()
 {
   if (title == null  issn == null)
   {
 searchHoldingsForm.recordError(Please provide a  
value

for Title or ISSN);
   }
 }
  public void onSubmitFromSearchHoldingsForm()
 {
   // perform database access using the form fields...
   ...
 However, the onSubmit...() will be called even if there is an  
error. Ok,

I could use a Boolean and set it in onValidate() and then bail out in
onSubmit...() if there is an error. Or I suppose I could dispense  
with

onValidateForm() altogether and set the error messages directly in
onSubmit...()  Or perhaps I should keep onValidateForm() and do the  
DB

stuff in onSuccess()?
What is the correct way to proceed and why?



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





RE: T5: query about onValidateForm()

2009-10-21 Thread Newham, Cameron

Something I've never done because it's not logical to have errors in success.

BTW, I believe you mean onValidateForm().  onValidate() is called before values 
are set and they can't be tested correctly.

Thanks Christophe, Uli, and Geoff for clearing this up.



-Original Message-
From: Geoff Callender [mailto:geoff.callender.jumpst...@gmail.com] 
Sent: 21 October 2009 13:21
To: Tapestry users
Subject: Re: T5: query about onValidateForm()

And you'd be well advised to get in the habit of doing all the work in  
onValidate() because errors occurring in onSuccess() won't display  
properly:

https://issues.apache.org/jira/browse/TAPESTRY-1972

Cheers,

Geoff   

On 21/10/2009, at 7:42 PM, Ulrich Stärk wrote:

 Please read the first paragraph of [1]. In short: submit gets fired  
 regardless of the validation outcome, success if validation was  
 successful, failure if not. validateForm is fired after the  
 individual field's validate events and allows for cross-field  
 validation.

 Uli


 [1] 
 http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html

 Am 21.10.2009 10:29 schrieb Newham, Cameron:
 Apologies if this is obvious, but I'm getting confused over how and
 where onValidateForm() should be used. I have a page with search  
 fields
 in a form and also a grid for the results.
 Currently I have:
   public void onValidateForm()
  {
if (title == null  issn == null)
{
  searchHoldingsForm.recordError(Please provide a  
 value
 for Title or ISSN);
}
  }
   public void onSubmitFromSearchHoldingsForm()
  {
// perform database access using the form fields...
...
  However, the onSubmit...() will be called even if there is an  
 error. Ok,
 I could use a Boolean and set it in onValidate() and then bail out in
 onSubmit...() if there is an error. Or I suppose I could dispense  
 with
 onValidateForm() altogether and set the error messages directly in
 onSubmit...()  Or perhaps I should keep onValidateForm() and do the  
 DB
 stuff in onSuccess()?
 What is the correct way to proceed and why?


 -
 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



Re: T5: query about onValidateForm()

2009-10-21 Thread Ulrich Stärk
That's not quite right. onValidateFromXYZ() ist called for field xyz as soon as that field 
validates. You can give it a parameter that gets populated with the field's value. You can't do 
cross-field validation though, that's what onValidateForm() is for.


Uli

Am 21.10.2009 14:40 schrieb Newham, Cameron:

Something I've never done because it's not logical to have errors in success.

BTW, I believe you mean onValidateForm().  onValidate() is called before values 
are set and they can't be tested correctly.

Thanks Christophe, Uli, and Geoff for clearing this up.



-Original Message-
From: Geoff Callender [mailto:geoff.callender.jumpst...@gmail.com] 
Sent: 21 October 2009 13:21

To: Tapestry users
Subject: Re: T5: query about onValidateForm()

And you'd be well advised to get in the habit of doing all the work in  
onValidate() because errors occurring in onSuccess() won't display  
properly:


https://issues.apache.org/jira/browse/TAPESTRY-1972

Cheers,

Geoff   

On 21/10/2009, at 7:42 PM, Ulrich Stärk wrote:

Please read the first paragraph of [1]. In short: submit gets fired  
regardless of the validation outcome, success if validation was  
successful, failure if not. validateForm is fired after the  
individual field's validate events and allows for cross-field  
validation.


Uli


[1] 
http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html

Am 21.10.2009 10:29 schrieb Newham, Cameron:

Apologies if this is obvious, but I'm getting confused over how and
where onValidateForm() should be used. I have a page with search  
fields

in a form and also a grid for the results.
Currently I have:
  public void onValidateForm()
 {
   if (title == null  issn == null)
   {
 searchHoldingsForm.recordError(Please provide a  
value

for Title or ISSN);
   }
 }
  public void onSubmitFromSearchHoldingsForm()
 {
   // perform database access using the form fields...
   ...
 However, the onSubmit...() will be called even if there is an  
error. Ok,

I could use a Boolean and set it in onValidate() and then bail out in
onSubmit...() if there is an error. Or I suppose I could dispense  
with

onValidateForm() altogether and set the error messages directly in
onSubmit...()  Or perhaps I should keep onValidateForm() and do the  
DB

stuff in onSuccess()?
What is the correct way to proceed and why?


-
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



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



Re: T5: query about onValidateForm()

2009-10-21 Thread Stephan Windmüller
Ulrich Stärk schrieb:

 That's not quite right. onValidateFromXYZ() ist called for field xyz as soon 
 as that field 
 validates. You can give it a parameter that gets populated with the field's 
 value.

Which class do I have to use while validating a select component?
Neither String nor Object work here.

- Stephan

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



Re: T5: query about onValidateForm()

2009-10-21 Thread Ulrich Stärk
It's working fine here using String. This works when providing an array of strings for the model 
parameter as well es when using an enum (I don't have other use cases atm). With an enum, your 
parameter can also have the respective enum type.


Uli

Am 21.10.2009 15:09 schrieb Stephan Windmüller:

Ulrich Stärk schrieb:

That's not quite right. onValidateFromXYZ() ist called for field xyz as soon as that field 
validates. You can give it a parameter that gets populated with the field's value.


Which class do I have to use while validating a select component?
Neither String nor Object work here.

- Stephan

-
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



Re: T5: query about onValidateForm()

2009-10-21 Thread Stephan Windmüller
Ulrich Stärk wrote:

 It's working fine here using String. This works when providing an array of 
 strings for the model 
 parameter as well es when using an enum (I don't have other use cases atm). 
 With an enum, your 
 parameter can also have the respective enum type.

I used it with something like

t:model=literal:1=first,2=second

but with String as parameter the method was never called.

- Stephan

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