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

Metro.validator.validate issue? #1518

Closed
TorakikiSan opened this issue Apr 6, 2020 · 5 comments
Closed

Metro.validator.validate issue? #1518

TorakikiSan opened this issue Apr 6, 2020 · 5 comments

Comments

@TorakikiSan
Copy link

Hi Olton and welcome back.

I'm trying to create a page where I can insert the data (the small daily expenses) which I will then insert in a sqllite table but without using the FORM tag, just call ajax.

The page and the ajax script:

https://codepen.io/TorakikiSan/pen/EeyWmp

As you can see, for each field I also inserted the data-validate tag which I then go to check in the script when I press the SUBMIT button with the Metro.validator.validate function

Correctly, the script checks (and possibly displays the error) for the first two fields, Item and Quantity, while considering the following fields valid even if the data-validate would indicate an error (try to leave the fields empty for example).

Where am I wrong?

Thanks

@olton
Copy link
Owner

olton commented Apr 6, 2020

Hi!
You must change date-validate to data-validate

@TorakikiSan
Copy link
Author

OMG, shame on me.... I checked, checked, checked and checked again but I just didn't see the stupid mistake.

One last question: in data-validate, what is the difference between "number" and "float"? In the Price field I had "required float" and whatever value I entered (I tried, for example, "5" "5.60" "5.") I always got an error.

Thanks

@olton
Copy link
Owner

olton commented Apr 11, 2020

Hi! I extend Utils.isFloat function for this issue

I always got an error for "5" "5.60" "5."

Now, for required float:
5 - false no decimal point
5.60 - true
5. - false no numbers after decimal point
1.0 - true
.1 - true

@olton olton added this to the 4.3.7 milestone Apr 11, 2020
@TorakikiSan
Copy link
Author

Many thank's Olton.

It's perfect!

@olton olton closed this as completed May 17, 2020
olton added a commit that referenced this issue Oct 28, 2023
olton added a commit that referenced this issue Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants