Change By: Federico Grilli (23/Oct/14 5:58 PM)
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".
I guess, it would be cool to have greater control over how we display errors on the UI or have a sensible default strategy, e.g. no validation performed automatically but only on submitting a form. In case of errors, validation is disabled until the next form submission. Just my zwei Rappen.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to