Hi Dennis,

For the 'conditional required' validation, expression validation
would not work because it is evaluated only when the field is not
null or empty.

# Please correct me if I am wrong.
# Although this is clearly documented, I tested it quite a while ago...

You can make both fields required and remove the validation error in
a validation method.

@ValidationMethod(when=ValidationState.ALWAYS)
public clearErrors(){
if (!anotherFieldHasACertainValue()) {
   errors.remove("aCertainField");
   ...
 }
}

See the doc for details.
http://www.stripesframework.org/display/stripes/Validation+Reference

HTH,
Iwao

on 09.2.4 11:22 PM d...@sparnord.dk said the following:
> 
> 
> Hi,
> 
> I have a stripes based application where I would like to make 
> conditional validations.
> 
> For instance a certain field is required if a certain other field has a 
> certain value, otherwise the field is not required.
> 
> Which would be the best way to fit this into stripes' validation?
> 
> 
> Thanks,
> 
> -dennis

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to