0 Replies Latest reply on Jan 27, 2010 4:02 PM by tgoodmannz_bss

    Custom validation formats in ES2 Guides / Models

    tgoodmannz_bss Level 1



      We are using an ES2 Guide, and we want to create a form which has custom field validators for things like e-mail addresses and phone numbers


      Is it best to create these validations in the model?  And if so how?  Or is it better to create reusable Flex controls for each of the field types (i.e. an e-mail address field)


      We have tried creating the validation in the Model - but have had problems.  Is there any good documentation on how to dio this




      In the Model We have created a new style for email validation:


      <style name="StyleEmail">


                  <validation text="Invalid Email">

                        <annotation name="ActionScriptValidator">

                              <item name="ValidatorClass">mx.validators.EmailValidator</item>

                              <item name="invalidCharError">"Invalid Email"</item>

                              <item name="invalidDomainError">"Invalid Email"</item>

                              <item name="invalidIPDomainError">"Invalid Email"</item>

                              <item name="invalidPeriodsInDomainError">"Invalid Email"</item>

                              <item name="missingAtSignError">"Invalid Email"</item>

                              <item name="missingPeriodInDomainError">"Invalid Email"</item>

                              <item name="missingUsernameError">"Invalid Email"</item>

                              <item name="tooManyAtSignsError">"Invalid Email"</item>





      But there is not error alerts if I apply the style to a field and input incorrect data.

      May be we should specify right expression in the “expr” tag (something like this: ^[a-zA-Z0-9_\\-\\.]+\\@[a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z]{2,3}$) but it doesn’t accept the format.