Validating collections
Richard Wallace <[email protected]> Wed, 20 Dec 2006 20:54:05 CST
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <773051.1166669675741.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
Hello again,
I have another question. This time I have a collection of Strings, and I want to apply a regex validator to all the elements. The form winds up looking something like:
<input type="text" name="zipCodes[0]" />
<input type="text" name="zipCodes[1]" />
<input type="text" name="zipCodes[2]" />
And my Action has a property an it that is a List<String> called zipCodes with appropriate accessors. Is it enough to specify a field validator and like:
<code>
<field name="zipCodes">
<field-validator type="regex">
<param name="expression"><![CDATA[(^[0-9]{5}?$)]]></param>
</field-validator>
</field>
</code>
Thanks,
Rich
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=54594&messageID=109298#109298