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.

Number field validation

  1. I am having trouble with the number field validation - if you enter "£100" instead of "100" then the form will leave that field blank!

    I can stop it from letting it through blank by making it a required field, but then the validation error message "This field is required" is not helpful at all, as people may try entering "£100" in again.

    Ideally if you enter "£100" I'd have some javascript strip out the £ sign, I will look into doing that, but is there any way to change the error message to "Please enter a number"?

    Posted 10 years ago on Tuesday May 14, 2013 | Permalink
  2. David Peralty

    Can you link to your form please? Are you using a number field? It should provide an error when a non-number is entered. Are you using the latest Gravity Forms and WordPress versions?

    Posted 10 years ago on Tuesday May 14, 2013 | Permalink
  3. I cannot link to the form as it's not a live site. I am using most recent versions of both, so I will try disabling plugins and see if that helps.

    Posted 10 years ago on Tuesday May 14, 2013 | Permalink
  4. David Peralty

    Let us know... It will be hard to help without seeing the issue though. All my best!

    Posted 10 years ago on Tuesday May 14, 2013 | Permalink
  5. I've found a way to replicate the problem on a new site. The setting "Output HTML5" needs to be enabled. This causes a submitted Number field with non-numbers in to go blank.

    Is there a fix for this?

    Posted 10 years ago on Wednesday May 15, 2013 | Permalink
  6. Hi David, have you found a fix for this yet? It is quite important to us.

    Posted 10 years ago on Thursday May 23, 2013 | Permalink
  7. David, sorry for bumping this again but it is a big issue with the plugin have you taken a look at this?

    Posted 10 years ago on Friday May 31, 2013 | Permalink
  8. David Peralty

    I just tested this on multiple installs, and when I have Output HTML5 turned on and put a non number in a number field, I get a message saying that the field needs to be a number. Are you using the latest versions of Gravity Forms and WordPress? Can you test your issue in Form Preview?

    Posted 10 years ago on Friday May 31, 2013 | Permalink
  9. Hi David,

    I am trying this with a local install of WordPress and Gravity forms, both latest versions. Default theme. In preview mode. (I've also tried it on a web server).

    If "Output HTML5" is checked, and I enter into a required Number field then the error message displayed is "This field is required".

    If the number field is not required then it will successfully submit the form but the number field will be blank.

    This is using a form with paging, if that makes any difference.

    Please advise!

    Posted 10 years ago on Wednesday June 5, 2013 | Permalink