Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float numbers in text form field validation doesn't work if used with max directive #3732

Closed
ViliusS opened this issue Jul 19, 2023 · 2 comments

Comments

@ViliusS
Copy link
Contributor

ViliusS commented Jul 19, 2023

Let's say in the blueprint I want to have a text field with input value for float. If max validation directive for that field is specified, you cannot input float numbers via Grav Admin UI.

Blueprint example which doesn't work:

myoption:
  type: text
  size: x-small
  label: "some label"
  validate:
    type: number
    min: 0
    max: 1

Blueprint example which does work:

myoption:
  type: text
  size: x-small
  label: "some label"
  validate:
    type: number
    min: 0

Looks like some kind of JavaScript bug in validation code.

P.S. I cannot use number field type either, because then HTML5 input validation blocks anything that is not integer completely.

@hurlon
Copy link

hurlon commented Oct 25, 2023

Using float number in number field type is partially possible with the step option and setting the step to the smallest allowed fractionnal part (e.g. 0.001 to allow floats with 3 digit after the decimal point).

But it seems to be buggy and for now validation may fail. See #3761 - Form validation for fields of type "number" fails sometimes even if the value is valid)

@rhukster
Copy link
Member

fixed in develop. thank.s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants