Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 374184 - Missing error marker when combining ValidCharacters and MinLength validations
Summary: Missing error marker when combining ValidCharacters and MinLength validations
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-14 05:51 EDT by Nobody - feel free to take it CLA
Modified: 2012-05-21 06:30 EDT (History)
1 user (show)

See Also:


Attachments
A text field with validation (1.42 KB, application/octet-stream)
2012-03-14 05:54 EDT, Nobody - feel free to take it CLA
no flags Details
test case (1.40 KB, patch)
2012-03-26 07:25 EDT, Nobody - feel free to take it CLA
christian.campo: iplog+
Details | Diff
fix (1.31 KB, patch)
2012-03-26 07:27 EDT, Nobody - feel free to take it CLA
christian.campo: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2012-03-14 05:51:52 EDT
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
Comment 1 Nobody - feel free to take it CLA 2012-03-14 05:54:46 EDT
Created attachment 212629 [details]
A text field with validation

adding the code
Comment 2 Christian Campo CLA 2012-03-14 06:24:16 EDT
good catch Jordan !!!
Comment 3 Nobody - feel free to take it CLA 2012-03-22 08:43:24 EDT
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
Comment 4 Nobody - feel free to take it CLA 2012-03-26 07:25:34 EDT
Created attachment 213172 [details]
test case
Comment 5 Nobody - feel free to take it CLA 2012-03-26 07:27:27 EDT
Created attachment 213173 [details]
fix

Attached test case and a possible fix.
Comment 6 Nobody - feel free to take it CLA 2012-04-04 09:54:41 EDT
pushed to GIT
Comment 7 Nobody - feel free to take it CLA 2012-04-04 09:59:11 EDT
changing status