Dumb SEO Questions

(Entry was posted by Yogesh Dhawa on this post in the Dumb SEO Questions community on Facebook, 06/25/2015).

Contact Form?

How to limit contact form phone number field according to the following:

All phone numbers must begin with the digit zero. The remaining 9 characters must be 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9.

Are there any scripts by which we can restrict the phone number field with the above conditions?
This question begins at 00:05:26 into the clip. Did this video clip play correctly? Watch this question on YouTube commencing at 00:05:26
Video would not load
I see YouTube error message
I see static
Video clip did not start at this question

YOUR ANSWERS

Selected answers from the Dumb SEO Questions Facebook & G+ community.

  • Yogesh Dhawan: How to limit contact form phone number field according to the following:

    All phone numbers must begin with the digit zero. The remaining 9 characters must be 0,1,2,3,4,5,6,7,8 or 9.

    Are there any scripts by which we can restrict the phone number field with the above conditions?
  • PromozSEO: Client side or Server side? Server side language?
    By the way, this question is no way related to this community topic.
  • PromozSEO: Client Side/ Javascript

    var phone_chk=/[^0-9]/g;
    var result_phone_chk=phone_chk.test(phone);
    var phone_fst=phone.substr(0,1);
    if((result_phone_chk==true) || (phone_fst!="0"))
    {
    //Error
    }

    Server Side PHP

    $phone_fst=substr($phone,0,1);
    if((!ctype_digit($phone)) || ($phone_fst!="0"))
    {
    //Error
    }

    You can check this code, should work.

View original question in the Dumb SEO Questions community on Facebook, 06/25/2015).