-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
dialog.validate.functions incorrectly joins validator results #4449
Comments
Or explicity check for boolean (=== true) in the following lines: ckeditor4/plugins/dialog/plugin.js Line 3251 in 5380706
ckeditor4/plugins/dialog/plugin.js Line 3253 in 5380706
|
Interesting find @bunglegrind, thanks for reporting. Indeed it looks like an issue in the code (and misleading documentation too). We will take a look on this one (and if there are any unintended consequences in the existing plugins). |
Well, you could start by updating the example in the docs. I spent one hour in order to discover what was going wrong... |
I can confirm the same. @bunglegrind - thanks for the suggestion of a workaround. |
Closed in #5248 |
Type of report
Bug
Provide detailed reproduction steps (if any)
just implement the sample code in the documentation
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-functions
Expected result
A validator composed by notEmpty and number
Actual result
A validator which always return true
Other details
Tested on 4.15.1 on Firefox latest version.
The sample code should be:
The real problem is that in case of failed validation, the validation functions (validate.regex for instance) return the error message which is actually a truthy value in javascript (unless it's the empty string). They should return false: the current behavior is quite misleading.
At least, please update the sample code in the documentation.
btw, there are no tests related to dialog.validate in tests/plugin/dialog
The text was updated successfully, but these errors were encountered: