Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts 1.? validation

 
Rod McLure
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if user enters an offenceDate I want to use this validation,
<field property="offenceDate" depends="date">
<arg position="0" key="errors.chargesOffenceDate"/>
<arg position="1" name="date" key="${var:datePatternStrict}" resource="false" />
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>

if they don't enter anything I don't need to do validation
documentation implies this could be done with requiredIf but I don't want to use because it is being deprecated

Thank you
 
Johnny Ganestruep
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I believe you can make your own custom validation. For instance, if the field is empty skip the validation otherwise perform the date validation.
 
Create symphonies in seed and soil. For this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!