Skip to content

Conversation

@hubipe
Copy link
Contributor

@hubipe hubipe commented Jan 24, 2018

  • bug fix? yes
  • new feature? no
  • BC break? no

JS validation in netteForms.js of FLOAT rule has been thrown, if value in input field contained more than 1 space, because String.replace(string, ...) replaces only first occurrence of given string. PHP method Validator::validateFloat on the other hand uses PHP method str_replace, which replaces all occurances of space in the input value (https://github.com/nette/forms/blob/master/src/Forms/Validator.php#L284).

I updated the JS String.replace inputs to replace all occurrences in the input value, not just first one. I also updated the regexp itself to be the same as the implementation in PHP (https://github.com/nette/utils/blob/master/src/Utils/Validators.php#L196)

@dg
Copy link
Member

dg commented Feb 6, 2018

Thanks!

@dg dg merged commit ba7d929 into nette:master Feb 6, 2018
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

Successfully merging this pull request may close these issues.

2 participants