We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3249
    • 3 Posts
    Let me first say that I stumbled through setting up eForm, I’m not a modx expert by any means. I finally got everything working on the form, except the phone number section.

    Here is what I have:

    <label for="phone">Contact Phone</label>
    <input id="phone" maxlength="40" name="phone" size="40" type="text" eform="Phone Number:integer:1" />

    I want it to be a require field and allow only numbers and "-" dashes in the xxx-xxx-xxxx format. Right now I can just enter in a single digit and it will submit.

    Let me know what other information you need to help me out. Thank you so much!
      • 11887
      • 34 Posts
      Helo

      eForm supports REGEX validation. Please see here: http://wiki.modxcms.com/index.php/EForm

      All you need to make this work is:

      - Read the above linked wiki page for eform, specifically the section on REGEX
      - Google for examples of regex expressions that fulfill the criteria you are looking for (hint, this website is good: http://www.regexlib.com/) - this will of course be different for you as it is for me. In my country, phone numbers don’t look that way.
      - Experiment

      Come back if you still can’t make it work.

      Thanks

      Mat
        • 10262
        • 5 Posts
        Quote from: mr at Mar 20, 2011, 01:37 PM

        Helo

        eForm supports REGEX validation. Please see here: http://wiki.modxcms.com/index.php/EForm

        All you need to make this work is:

        - Read the above linked wiki page for eform, specifically the section on REGEX
        - Google for examples of regex expressions that fulfill the criteria you are looking for (hint, this website is good: http://www.regexlib.com/) - this will of course be different for you as it is for me. In my country, phone numbers don’t look that way.
        - Experiment

        Come back if you still can’t make it work.

        Thanks

        Mat


        Could you please write a example?
        i dont know how to intergrate this

        This didnt work for me:

        <td width="86"><input name="Telefoonnummer" type="text" onfocus="this.value=(this.value==’Telefoonnummer’)? ’’ : this.value ;" value="Telefoonnummer" size="14" maxlength="60" eform="Telefoonnummer:html:1" #REGEX (^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$)" /></td>
        <td width="77"><input type="submit" name="submit" value="Verzenden" class="bel-button"></td>
          • 16278
          • 928 Posts
          I think this will cover your telephone number format:
          eform="Telephone::0:Invalid telephone number:#REGEX /^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$/" 

          laugh KP