[MGNLUI-3212] BasicTextCodeField validation kicks in on each input change Created: 22/Oct/14 Updated: 09/Mar/21 Resolved: 09/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | forms |
| Affects Version/s: | 5.3.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Federico Grilli | Assignee: | Unassigned |
| Resolution: | Workaround exists | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
I created a GroovyValidator which checks for the formal source code correctness upon saving a Groovy script. The validator is attached to a basic text code field. If I start writing invalid Groovy code the validator does not complain and that's fine, because ideally that should happen only upon saving the form. Once I save the form the validator rightly complains and shows an error. The annoying thing now is that trying to fix the code will trigger validation for each input change thus cluttering the UI with error messages. See attached screenshot. After further debugging I actually found out that validation is triggered at each StateChangeEvent fired by the field which currently has the focus (see com.vaadin.ui.AbstractField.getErrorMessage() at line 1034 where the condition is true by default). The only reason validation errors are not displayed immediately but only upon saving a form is found at info.magnolia.ui.vaadin.form.FormSection.getErrorMessage() line #109. That state variable is false until a SaveAction e.g. info.magnolia.ui.form.action.SaveFormAction changes its value at line #87. From then on validation errors are shown in "real-time". |
| Comments |
| Comment by Roman Kovařík [ 09/Mar/21 ] |
|
The behaviour can be specified. |