Hi Brian,
I would make all the ten fields required and remove errors for the
fields 6-10 in a custom validation method when the checkbox is not
checked.
@ValidationMethod
public clearErrors(){
if (!checkboxIsChecked) {
errors.remove("field6");
errors.remove("field7");
...
}
}
You may want to set proper priority for the validation method if you
have other custom validation methods.
Hope this helps,
Iwao
On 2008/07/26, at 12:01, "Brian Wawok" <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> Been working through a simple stripes app, and am having trouble on
> what the "stripes" way to do something is.
>
>
>
> Situation - I have 10 fields (String) and a checkbox. Fields 1-5
> are required always. Fields 6-10 are required only if the checkbox
> is checked. I can't figure out how to make validation for fields
> 6-10 (for the required=true part) happen at the same time as the
> validation for 1-5.
>
>
>
> I am doing it using something like this...
>
>
>
> if (checkboxIsChecked) {
>
>
>
> if (field5 == null || field5 == "") {
>
> errors.add("field5", new
> SimpleError("Field5 is required")
>
> }
>
>
>
> ....
>
> }
>
>
>
>
>
> In my event handler that processes a form submission.
>
>
>
> This WORKS.. but
>
>
>
> 1) Not very stripsey
>
> 2) It only makes it this far if 1-5 all pass validation.
>
>
>
> I want all the validation to happen at once. I tried adding this to
> a custom method with the @Before annotation, but I can't figure out
> a way that won't break field1-5 validation in the process.
>
>
>
> Thanks!
>
>
>
> Brian
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users