>
I do not disagree about the research part at all. I know it will take a
researcher on my staff a great deal of time to maintain, but it is never
the less, a needed feature. I just thought that most Countries have a
fairly well formatted number. And mostly I am taking about supporting
N.&S. America, Western Europe only. Later look at the far East.
<

You may be able to accomplish what you want using localized forms and
the mask rule in the validator.  Assuming that your default
language/country is en_US (a parochial assumption, I know), your
validation.xml might contain bits like the following:

<formset>
  <form name="userInfo">
    <field property="telephone" depends="mask">
      <var>
        <var-name>mask</var-value>
        <var-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</var-value>
      </var>
    </field>
  </form>
</formset>

<formset language="en" country="GB">
  <form name="userInfo">
    <field property="telephone" depends="mask">
      <var>
        <var-name>mask</var-value>
        <var-value>--a regexp for British phone numbers -- sorry, never
been :)--</var-value>
      </var>
    </field>
  </form>
</formset>

...and so on for each language/country.  Your researchers would have to
provide you the masks for each country, and, as you add counties, you
would add their formsets to validation.xml.  A standalone validation
rule might be more convenient, but this sort of approach might do the
job for you.  The struts-validator example webapp has a couple of sample
forms that perform locale-specific validations.

-Greg



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to