Struts Validator - Validwhen and Map backed forms

S

smrimell

Hi,

Regarding the Struts validator framework:-
Does anybody know whether its possible to use the validwhen validator
determine whether a field is required based on the value of a map
backed form property:-

i.e:-
This validator field element should make the property
"demographic(fav_color)" mandatory if the map backed property
"mandatory(fav_color)" is not 'false'.

<field property="demographic(fav_color)" depends="validwhen">
<msg name="validwhen" key="errors.required" />
<arg name="validwhen" key="form.demographic.favColor" />
<var>
<var-name>test</var-name>
<var-value>((mandatory(fav_color) != "false") or (*this* != null))</
var-value>
</var>
</field>

However this gives me an exception when run. The exception is as
follows:-
"ValidWhen Error for field ' demographic(fav_color)' - line 1:3:
unexpected token: mandatory"

I'm assuming that using validwhen with map backed properties is not
possible and is a recipe for struts inspired developer rage! Please
tell me I'm wrong :)

thanks in advance,
smrimell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top