• Hi, Firefox and IE11 allows space in input type number fields. Is it possible to disallow spaces?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • It’s a firefox “issue”. for instance you can also insert the other chars.
    https://quirksmode.org/html5/inputs/

    A walkaround (if necessary) is to use some js to fix incorrect entry but, if it’s not too much relevant, I would let the validation do the job.

    Thread Starter anea42

    (@anea42)

    Thank you Erik for quick response.
    What do you mean with “let the validation do the job”? Contact 7 sends an error if theres a space in the input für telephone. The form is not send. It would be helpful if the number could also be sent with spaces.

    the number field requires it to be a number while “123 456” is a string, this is the reason why with a space you get an error, and the validator in this case “do its job”.

    But if this is an unwanted behavior you can want to access the submitted data and edit the number field, remove from the submitted data spaces and then convert to int. This will also remove “+”, “(” and other unwanted chars before validation.
    https://contactform7.com/2020/07/28/accessing-user-input-data/

    you can also write your custom validation
    https://contactform7.com/2015/03/28/custom-validation/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Don’t allow spaces in input html’ is closed to new replies.