[MGNLUI-3445] RichTextField: Emptying the fields content and saving does not remove the property, just empties it -> required validation does not work Created: 27/May/15 Updated: 21/Aug/15 Resolved: 19/Aug/15 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | dialogs, forms |
| Affects Version/s: | 5.3.8 |
| Fix Version/s: | 5.3.11, 5.4.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Ringele | Assignee: | Evzen Fochr |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | ckeditor, support | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 1d 1h | ||
| Original Estimate: | Not Specified | ||
| 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: | |||||||||||||||||||||
| Sprint: | Sprint 6 (Kromeriz) | ||||||||||||||||||||
| Story Points: | 3 | ||||||||||||||||||||
| Description |
|
When removing the content of an existing RichTextField and saving, the property is not removed but just emptied. This has as a consequence, that the "required=true" validator is not reacting, it accepts as the property exists. |
| Comments |
| Comment by Christian Ringele [ 28/May/15 ] |
|
Update: First this is called to validate: com.vaadin.ui.AbstractField.validate() if (isRequired() && isEmpty()) { throw new Validator.EmptyValueException(requiredError); } validate(getFieldValue()); isEmpty() calls com.vaadin.ui.AbstractField.getFieldValue() if (dataSource == null || isBuffered() || isModified()) { return getInternalValue(); } // There is no buffered value so use whatever the data model provides return convertFromModel(getDataSourceValue()); com.vaadin.ui.AbstractField.getFieldValue() BUT dataSource is not NULL as the property exists. So in the end its not Empty, and if you call getValue() in the field you get "" and not NULL. Workaround:
Of course you cal also ass the code the the origin info.magnolia.ui.vaadin.richtext.MagnoliaRichTextField class and add it to the 'class' folder of your webapp (overload the class). |
| Comment by Evzen Fochr [ 19/Aug/15 ] |
|
Set value to null is because we do not want to create (want to remove) jcr property with empty string value (same behavior as for normal textField). |