Struts Validation.xml - requirement issue
I want my validation.xml file to only validate null if certain options are selected from the dropdown. So far i
<field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name>field[0]</var-name>
<var-value>moverChangeType</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>EQUALS</var-value>
</var>
<var>
<var-name>fieldValue[0]</var-name>
<var-value>Conversion</var-value>
</var>
</field>
When Conversion is selected from the moverChangeType dropdown, I was hoping that the empFDServiceStartDate field would be checked for errors before saving it. It doesn't work at the moment and it allows me to store zeros.
Any idea?
I am tied to struts 1.1 and therefore cannot use newer commands.
M
0
Matt124
source
to share
2 answers
You can do this multiple tests in one test, for example:
<field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>((moverChangeType == "Conversion") or (moverChangeType == "SomethingElse"))</var-value>
</var>
</field>
+1
source to share
If you want to check a field if moverChangeType is "Conversion", try this ...
<field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>(moverChangeType == "Conversion")</var-value>
</var>
</field>
0
source to share