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

Updated netteForms.js to conform with PHP validation #174

Merged
merged 1 commit into from
Feb 6, 2018
Merged

Updated netteForms.js to conform with PHP validation #174

merged 1 commit into from
Feb 6, 2018

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