This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes struts 1.? validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 1.? validation" Watch "struts 1.? validation" New topic
Author

struts 1.? validation

Rod McLure
Greenhorn

Joined: Mar 04, 2010
Posts: 24
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

Joined: Nov 22, 2010
Posts: 3
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.
 
Don't get me started about those stupid light bulbs.
 
subject: struts 1.? validation
 
Similar Threads
Struts Password and Email server-side validation
ValidWhen problem in struts 1.3.10
Exception while loading the validation.xml in strusts
Error logging in Client side validation
custom validator and custom tags