Support

Account

Home Forums General Issues Looking for numeric field type documentation

Solving

Looking for numeric field type documentation

  • Hi,
    I’m a bit lost. I search the documentation of the numeric field type.

    I’d like to allow users, to enter numeric values with a dot (.) as decimal separator in a numeric field. But it allows only integer values or values with a decimal comma.

    I’d appreciate any helpful hints.

    Regards

  • The front-end output seems to be always with a decimal point.

  • What are the field settings for the number field where you’re having this issue?

  • I only set label, name, type ‘numeric’ and that it’s required. Everything else is empty.

  • Just tried it and I can add decimal point. If you don’t set the “step” value then you must enter the . manually. Scrolling will only show integers. If you want the . and decimal value to show while scrolling the you need to set the step value an set it to something like .1 or .01

  • Hi,
    I also can’t set the step value with a decimal point, but with a decimal comma I don’t get an error message.
    It might be a “locale” problem.
    I’m just wondering, why it doesn’t work back-end, but outputs as I want it on the front-end site.

  • Hi,
    after reading some posts about input type number I tested different browsers and settings with a simple html form.

    1. Setting 1:
      • lang attribute of the body set to de-DE
      • lang attribute of input field #1 set to de-DE
      • lang attribute of input field #2 set to en-US
      • step attribute set to 0.001 in both input fields
      • Results: Chrome indifferent to input with decimal point or comma. Firefox sensitive to inputs in field #1 (requires decimal comma), indifferent to inputs in field #2.
    2. Setting 2:
      • lang attribute of the body set to de-DE
      • no lang attribute set on the input fields
      • step attribute set to 0.001 in both input fields
      • Results: Chrome indifferent. Firefox sensitive to inputs in both fields, requires decimal comma.
    3. Setting 3:
      • lang attribute of the body set to de-DE
      • lang attribute of input field #2 set to en-US
      • step attribute set to 0.001 in both input fields
      • Results: Chrome indifferent to input with decimal point or comma. Firefox sensitive to inputs in field #1 (requires decimal comma), indifferent to inputs in field #2.
    4. Setting 4:
      • lang attribute of the body set to en-US
      • lang attribute of input field #1 set to de-DE
      • lang attribute of input field #2 set to en-US
      • step attribute set to 0.001 in both input fields
      • Results: Chrome indifferent to input with decimal point or comma. Firefox sensitive to inputs in field #1 (requires decimal comma), indifferent to inputs in field #2.
    5. Setting 5:
      • lang attribute of the body set to en-US
      • no lang attribute set on input fields
      • step attribute set to 0.001 in both input fields
      • Results: Chrome indifferent to input with decimal point or comma. Firefox indifferent.

    Conclusion: The validation of the input type number field depends indeed on the browser, i.e. validation rules vary across browsers. While Firefox applies stricter rules than Chrome, and – as far as I read – Safari.

    So, how can I add a radio button in the ACF field settings to choose a lang attribute and then set the input field to it?

  • I have not dealt with issues related to the formatting of numbers in other languages that use a , instead of . for the decimal separator. I have looked but I have found no information on how this is handled by field and how it can effect validation. As far as I know php only understands the . as the decimal separator, but I could be wrong as I cannot find any information on this. As far as the browser requiring a , I couldn’t begin to tell you how fix this.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Looking for numeric field type documentation’ is closed to new replies.