Karthik Ganesan
Karthik Ganesan

Reputation: 4242

Parsley Range validation error message issue

I have a field to which I am setting the range validation dynamically from 70.00 to 1050.00 which works fine as shown below

enter image description here

The issue is when the field is validated it shows the error message ignoring the decimal points

enter image description here

I want the error message to say "This value should be between 70.00 to 1050.00." I tried searching and doing some changes to my code but it didn't help.

Can someone point me on how to get this done?

Side Note: It works if decimal places has other values in it like "70.01 to 1050.01"

Upvotes: 2

Views: 1145

Answers (2)

Karthik Ganesan
Karthik Ganesan

Reputation: 4242

Ok, So I added a attribute at runtime "data-parsley-range-message" and added my error text to it which did the trick.

Thanks

Upvotes: 1

Marc-André Lafortune
Marc-André Lafortune

Reputation: 79612

Right, parlsey converts them to float, then back to string. I'm not sure how simple it would be to change this, but I'm wouldn't be opposed to a PR. Or customize the error message.

Upvotes: 0

Related Questions