Community
Participate
Working Groups
Build Identifier: Setting both - ValidCharacters and MinLength validation rules to a text ridget leads to a wrong error marker behavior. Reproducible: Always Steps to Reproduce: 1. The given snippet creates a text field (and ridget) with two validation rules: - Length of at least 5 (five) chars - Only numbers allowed 2. Input _four_ numbers (not five!). The error marker should say that the length must be at least 5. 3. Now input a forbidden character like a letter. It will not appear in the text field so the input will be still invalid. 4. The error marker will disappear
Created attachment 212629 [details] A text field with validation adding the code
good catch Jordan !!!
Some validators like ValidCharacters block the invalid input. For example, if a text field must contain only numbers and the ValidCharacters validator is set, any attempt to enter an invalid character (e.g. letter) will be ignored and a flashing error marker will be shown. Technically the doit flag on the validation event is set to false if the validation fails. The implementation of TextRidget.ValidationListener calls the validation of the _NEW_ (possibly invalid) value in the text field and sets the appropriate error markers if any. If one of the validators blocks the input (doit = false), the _OLD_ value will stay in the text field. The bug is that ignoring the _NEW_ invalid value must also ignore its validation results and error markers and restore the error markers for the _OLD_ value. Currently the text field is presented with the old value, but with the error markers of the new (ignored) value. What is happening in the snippet: 1. The user inputs 1234 in the text field. TEXT FIELD: 1234 - MinLength shows error - ValidCharacter shows OK 2. The user hits a letter - 'p' TEXT FIELD: 1234 - text to validate 1234p - MinLength shows OK (length = 5) - ValidCharacters blocks the input of 'p' (doit = false) and shows a flashing error marker, then OK because the invalid input will be ignored 3. After the flashing error marker disappears TEXT FIELD: 1234 ('p' was ignored) - MinLength shows OK (no validation was triggered after ignoring the 'p') - ValidationCharacters shows OK => no error marker is shown
Created attachment 213172 [details] test case
Created attachment 213173 [details] fix Attached test case and a possible fix.
pushed to GIT
changing status