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

Reply via email to