Appnitro Software Forums » MachForm 2

required Phone field with a 0 (zero)


  1. Hi,

    in Switzerland we can use the U.S. Phone Format.

    but we have an area code like (044) ### - ###

    and a 0 is for a required field not valid.

    How can I change it?
    see: http://www.italien.ch/machform/view.php?id=4

    Posted 2 years ago #
  2. strange, why is 0 in MachForm not a number?

    Posted 2 years ago #
  3. It's not about MachForm doesn't recognize 0 as number. It's about the US Phone number.
    The area code within the US Phone number don't have any leading zero. That's why you get the error.

    However, this can be easily adjusted.
    Edit your "includes/common-validator.php" file, search around line 131 for this code:

    $regex  = '/^[1-9][0-9]{9}$/';

    change it with this one:

    $regex  = '/^[0-9][0-9]{9}$/';

    that should allow 0 within the area code.


    MachForm Founder

    Posted 2 years ago #
  4. really thanks. It works ;-D

    turischt

    Posted 2 years ago #

RSS feed for this topic

Reply