PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Phone Number, required full number

  1. Hi

    I am using single input field with mask for entering UK number.
    Problem I have is how to make sure people have to input all numbers.

    My mask is 99999999999 which should result in numbers eg. 01642123456

    I had few situation that clients entered space which resulted with 01642 12345
    or just forgot to enter last digit.

    Is there a way to make sure all numbers are entered and if not warning is displayed?

    Cheers
    Kris

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  2. Can you share a link to this form online? The input mask requiring all digits should prevent input of anything other than a digit, which would do what you want. I added a mask as you have shown and was unable to enter a space character.

    The input mask relies on client side JavaScript to force the input. If you would like to further ensure you get only digits and the correct number of digits, you can use the gform_validation filter to check the value that was submitted and return an error if it does not correspond to your rules:

    http://www.gravityhelp.com/documentation/page/Gform_validation

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  3. I just check and you are correct, I use this form on other websites and works as you described but on this one http://www.hairgonewrong.com in "We’ll call you back" form it doesn't work.

    Looks like javascript doesn't work for this validation.

    Any help appreciated.

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  4. The input mask is not present in the sidebar form at all. How did the form get added to that sidebar, and is that different than how it was done on the other sites?

    It looks to me link the jQuery is added to the footer in this site. It needs to be in the header to work properly when the page is loaded. Can you compare that to your other sites which use this form?

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  5. Hi I found that the problem has to be with the way I'm adding it to the sidebar.

    <?php gravity_form(1, true, true, false, "", false); ?>

    By itself it doesn't work but on pages with proper contact form added in content of the article it works, and then sidebar works as the mask rule exists from main form.

    My php way of calling the form has to be wrong and it does not pull required javascript.

    On the side note, I would prefer php to add forms in sidebar, so I need better way of doing that.

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  6. Ok, I found solution.

    When adding forms from wordpress theme with php I need to place
    <?php gravity_form_enqueue_scripts(1, true); ?>
    in header.php just before <?php wp_head(); ?>

    ref: http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Thank you for help anyways.
    Kris

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink
  7. David Peralty

    Glad you were able to figure it out. All my best!

    Posted 11 years ago on Tuesday October 16, 2012 | Permalink

This topic has been resolved and has been closed to new replies.