Support » Plugin: Contact Form 7 » Number input filed validation issue

  • Hello,

    I have an issue with number field validation in all browsers. I have a Postnr field in the form that should only have numbers and it needs to be in total 5 digits. If I set thefield to [number* zip id:PostNr min:5 max:5 placeholder “*Postnr:”] I get the error message all the time even if there are 5 digits entered. If there is only one digit it outputs “The number is smaller than the minimum allowed.” If there are more than 5 digits it outputs “The number is larger than the maximum allowed.” Could you please hellp.

    Thanks,
    Kirill

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Hello,

    Yes I saw this article, I did all according to it. The issue is that Contact form 7 outputs an error message not according to the settings. I set min:5 and max:5 for postNr number input, but if you enter 5 digits, it gives the error that β€œThe number is larger than the maximum allowed.” You can see it on this page http://demo.mediamenu.ee/wordpress/lserin/

    Thanks,
    Kirill

    I think you’ve misunderstood the max and min attributes. These attributes regulate the value of the field and not the length of the field. If what the field accepts is really a number which is always five characters long, you could try:

    [number* zip id:PostNr min:10000 max:99999 placeholder β€œ*Postnr:”]

    Which accepts values between the minimum five character integer 10000 and the maximum five character integer 99999. If in your case a valid PostNr can begin with leading zeroes, than it is not a number value and you should use a text field.

    • This reply was modified 1 year, 7 months ago by  Jarred Kennedy. Reason: Technically the least and greatest five-character positive integers, not numbers
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Number input filed validation issue’ is closed to new replies.