<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">

<form-validation>
     <global>
      <constant>
        <constant-name>phone</constant-name>
        <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</constant-value>
      </constant>
      <constant>
        <constant-name>zip</constant-name>
        <constant-value>^\d{5}\d*$</constant-value>
      </constant>
      <constant>
        <constant-name>currency</constant-name>
        <constant-value>^\d{1,3}(,?\d{1,3})*\.?(\d{1,2})?$</constant-value>
      </constant> 
   </global>
   <formset>
        <form name="uploadForm">
            <field property="name" depends="required">
                <arg0 key="uploadForm.name"/>
            </field>
            <!-- Client-side Javascript won't catch this, but server-side will -->
            <field property="file" depends="required">
                <arg0 key="uploadForm.file"/>
            </field>
        </form>
    </formset>

  <formset>
      <form name="addressForm">
              <field property="city"
                     depends="required">

                  <arg0 key="addressForm.city"/>
              </field>
              <field property="province"
                     depends="required">

                  <arg0 key="addressForm.province"/>
              </field>
              <field property="country"
                     depends="required">

                  <arg0 key="addressForm.country"/>
              </field>
              <field property="postalCode"
                     depends="required,mask">
                  <msg
                    name="mask"
                    key="errors.zip"/>

                  <arg0 key="addressForm.postalCode"/>
                  <var>
                    <var-name>mask</var-name>
                    <var-value>${zip}</var-value>
                  </var>
              </field>
      </form>
      <!-- <form name="userForm">
              <field property="username"
                     depends="required">

                  <arg0 key="userForm.username"/>
              </field>
              <field property="password"
                     depends="required,twofields">
                  <msg
                    name="twofields"
                    key="errors.twofields"/>

                  <arg0 key="userForm.password"/>
                  <arg1
                    key="userForm.confirmPassword"
                  />
                  <var>
                    <var-name>secondProperty</var-name>
                    <var-value>confirmPassword</var-value>
                  </var>
              </field>
              <field property="confirmPassword"
                     depends="required">

                  <arg0 key="userForm.confirmPassword"/>
              </field>
              <field property="firstName"
                     depends="required">

                  <arg0 key="userForm.firstName"/>
              </field>
              <field property="lastName"
                     depends="required">

                  <arg0 key="userForm.lastName"/>
              </field>
              <field property="addressForm.city"
                     depends="required">

                  <arg0 key="userForm.addressForm.city"/>
              </field>
              <field property="addressForm.province"
                     depends="required">

                  <arg0 key="userForm.addressForm.province"/>
              </field>
              <field property="addressForm.country"
                     depends="required">

                  <arg0 key="userForm.addressForm.country"/>
              </field>
              <field property="addressForm.postalCode"
                     depends="required,mask">
                  <msg
                    name="mask"
                    key="errors.zip"/>

                  <arg0 key="userForm.addressForm.postalCode"/>
                  <var>
                    <var-name>mask</var-name>
                    <var-value>${zip}</var-value>
                  </var>
              </field>
              <field property="email"
                     depends="required,email">

                  <arg0 key="userForm.email"/>
              </field>
              <field property="phoneNumber"
                     depends="mask">
                  <msg
                    name="mask"
                    key="errors.phone"/>

                  <arg0 key="userForm.phoneNumber"/>
                  <var>
                    <var-name>mask</var-name>
                    <var-value>${phone}</var-value>
                  </var>
              </field>
              <field property="website"
                     depends="required">

                  <arg0 key="userForm.website"/>
              </field>
              <field property="passwordHint"
                     depends="required">

                  <arg0 key="userForm.passwordHint"/>
              </field>
      </form> -->
  </formset>
</form-validation>
