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
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