[Validation] "on: 'blur'" and "on: 'change'" validation settings produce an error when used on a selection dropdown that allows a user to search through a list of options
Hey,
- JSFiddle showcasing the issue. Open developer console, click on the dropdown to see a list of options, then click anywhere outside of it and its list of options choosing nothing; you should get this error:
Uncaught TypeError: Cannot assign to read only property 'identifier' of false. Optionally, comment out theon: 'blur'setting (or try withon: 'change'separately), run JSFiddle, and submit the form—the dropdown should be validated without errors. - Link to the documentation describing the type of a problematic dropdown.
- Issue #3141 is probably related.
From what I briefly tested, validation actually works for the dropdown (or it seems this way), just throws an error for some reason. You also won't see an error if you'll somehow induce validation checking before touching the dropdown, say, by submitting a form or correcting some other field that didn't pass on: 'blur' validation before—try it, reload that JSFiddle, submit the form first, then click on the dropdown and outside of it and its list of options to get an error (that you won't get this way). The solution right now is to leave the setting on the default on: 'submit', but a form may contain other inputs that can benefit from on: 'blur' or on: 'change'.
Thank you for your time.
I was going to post the same thing, I had not yet narrowed it down to the dropdown but did determine on: 'blur' resulted in the error Uncaught TypeError: Cannot assign to read only property 'identifier' of false and on: 'submit' works as expected.
I solved by changing the form's selectors:
selector {
message : ' .error.message ' ,
field : 'input:not(.search), textarea, select' ,
group: ' .field ' ,
input : ' Input ' ,
prompt : ' .prompt ' ,
submit : ' .submit '
}
this excludes the search input of the dropdown from validation.
It was fixed with #3131 and 2.1.5.