You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thomas Hackel <th...@bi-so.com> on 2005/02/05 14:05:48 UTC

Two states of validation? (dont) Validate a form depending on which button pressed

Hi there,

i havve an app with a form in which are a "Send" and "Save" button of 
the form.

When the user clicks Send the form should be validated as usual but when 
he clicks the Save button there should be NO validation at all!

Since the validator is called before the button listener is executed, i 
have really no clue how to accomplish this task.

thanks for any help!

thomas


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


Re: Two states of validation? (dont) Validate a form depending on which button pressed

Posted by Ben Binford <be...@gmail.com>.
Caveat: I haven't tried this, but I see no reason that this shouldn't work:

in your form define a @Hidden component bound to a boolean property
with a hydrator method. The hydrator method should place the value of
this property on the request using cycle.setAttribute. The hidden
component will need to be the first component contained in the form so
that tapestry will execute it first.

You will need to attach javascript to your save handler to set the
value of the hidden component to true.

In your validators you can access the request cycle via the
iformcomponent parameter and retrieve the attribute. If it is true you
should not throw any validation exceptions.

Hope this idea helps!

Best Regards,
Ben




On Sat, 05 Feb 2005 14:05:48 +0100, Thomas Hackel
<th...@bi-so.com> wrote:
> Hi there,
> 
> i havve an app with a form in which are a "Send" and "Save" button of
> the form.
> 
> When the user clicks Send the form should be validated as usual but when
> he clicks the Save button there should be NO validation at all!
> 
> Since the validator is called before the button listener is executed, i
> have really no clue how to accomplish this task.
> 
> thanks for any help!
> 
> thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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