Announcement Announcement Module
Collapse
No announcement yet.
Validation Framework Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation Framework

    Hi,

    How can i validate my form?

    Like in ur petclinic project, Login Form, there are some validation that appear in the SimpleMessageAreaPane.

    Eg. when we type more than 8 characters, there is some error message in the SimpleMessageAreaPane. How do you do it?

    I can't found where is the validation made.

    Pls help me...

    Thx


    Ulil

  • #2
    Ulil,

    Currently there are two ways: your form object can implement the RulesProvider interface, like the Login SessionDetails class does, or you can register validation rules by configuring a RulesSource instance, like Petclinic's "ValidationRulesSource" class.

    We will also be adding an easy way to register local rules for a given form, making that part of the form model API.

    Comment


    • #3
      Thx for your answer...

      Sorry, I want to ask again : :wink:

      What types that the RegexpConstraint have? For example in PetClinicValidationRulesSource :

      Code:
       
      all(new Constraint[] { required(), maxLength(25),
                      regexp("[a-zA-Z]*", "alphabetic") });
      Is there another type beside the "alphabetic" type?


      Thank you so much.....


      ulil

      Comment


      • #4
        the "alphabetic" string is not the constraint, but the key used to fetch the error message from messages.properties.

        the first argument of the regexp() method is the regular expression you want to check against.

        hope this helps

        Comment


        • #5
          Thank you very much for your answer.. :P

          Comment

          Working...
          X