On 5/19/07, Paolo Beccari <[EMAIL PROTECTED]> wrote:
Hi all,
I'm a S2 newbie.
Trying to validate input in a *-validation.xml, and found a strange
behaviour:
<validators>
<field name="id">
<field-validator type="required">
<message key="required"/>
</field-validator>
<field-validator type="regex">
<!--param name="regex">[0-9]</param-->
<param name="expression">[0-9]</param>
<!--message key="requirednumber"/-->
<message>id is not a numeric value</message>
</field-validator>
</field>
</validators>
When i test validation, the "required" key is shown correctly (taken from
package.properties file), but instead of "requirednumber" key (as shown
above I tried with a plain message too), i'm always receiving a "Invalid
field value for field "id"." message.
Someone can help?
P.
Hi Paolo, I'm a newbie as well, but I'm going to try to answer this one
since I've run into a similar problem. The validation seems to happen in the
order that is specified in the xml file. My mistake was that I left id
specified in the request parameters, but since it was a post form submission
I needed to included in the actual form (so that the properties in the
action get set accordingly). So just check that you have an id field in your
form (usually a hidden field).
Hope that helps.
Will