--- On Thu, 11/13/08, Burton Rhodes wrote: > How do I use validation in an [Action]-validation.xml file > to validate several fields? > > I need to implement the following logic for 3 fields on a > form: Company, FirstName, LastName. > > Psedo Code: > > If Company empty, then FirstName and LastName must be filled > If FirstName and LastName empty, then Company Must be filled. > > I am having trouble seeing how this can be accomplished > with the "expression" validator type.
Besides the expression help already provided, I'd add that personally I'd put this in the Java code rather than in the XML file. It's probably just me, so take it with a grain of salt--as soon as anything gets even a little bit complicated (this usage might not qualify as "complicated" since it's trivial, so it's on the edge) I'll put it in a validate() method, possibly calling super.validate() to handle simple XML-based validations. It's (generally) easier to debug in the Java code. With regards to doing it via JavaScript, sure, that's a viable solution, but until I actually *apply* my patch to allow quick and easy custom JavaScript validations you'll have to take the route of modifying the template as another poster mentioned, or do it a bit more outside of the S2 JavaScript validation. (Hopefully I'll get to the patch this weekend, and I'll put it in a JIRA issue including the patch so people can use it with previously-released versions.) Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]