Hi!

I'm using the Struts 2 validation for my form fields. For a required numeric
input field, I've set the "required" and the "int" validator and a custom
message for each of them. But when the user enters none numeric characters,
the custom localized required-messages and a default "Invalid field value"
message are displayed in the error box. Also a NoSuchMethodException occurs
because Struts tries to store the alphanumeric field value in an action
class property of type string.

Why is a the field marked as required, when the user has entered a wrong,
but has entered a value?

Why is a default message instead of my custom message shown?

And why is there is Struts trying to store the value in a bean property, if
the value is identified as invalid?

Here is my validation:

  <field name="myNumber">
    <field-validator type="required">
      <message key="addEntry.error.myNumber.required" />
    </field-validator>
    <field-validator type="int">
      <message key="addEntry.error.myNumber.format" />
    </field-validator>
  </field>

I'm using Struts 2.1.8.1. The valiidateion XML is assigned to the action
class. The action class implements ModelDriven but myNumber is outside the
model class in the of type Integer.

Thanks for any hints or comments.

Titus

-- 
View this message in context: 
http://old.nabble.com/S2-Strange-behaviour-of-validation-tp26551371p26551371.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to