![]() |
|
|
|
|
Issue Type:
|
Improvement
|
|
Affects Versions:
|
5.3.4, 5.2.10 |
|
Assignee:
|
Unassigned |
|
Attachments:
|
CompositeField-Required.jpg, CompositeField.patch |
|
Components:
|
forms |
|
Created:
|
29/Oct/14 12:31 PM
|
|
Description:
|
Setting on the CompositeFieldDefinition the required property it is ignored.
So if one needs to ensure that all fields in the composite need to be filled out, one must set to all sub fields a required property.
Much easier would be if the required could be set on the composite itself.
Use case definition:
If the Composite field sets required=true, every sub field in the composite needs a value.
Problem:
CompositeFieldDefinition does not implement isValid(), and the super's isValid is only checking the validation of the sub fields.
This code solves the problem, I included a patch.
@Override
public boolean isValid() {
boolean isValid = super.isValid();
if (this.isRequired()) {
List<AbstractField<PropertysetItem>> fields = getFields(this, false);
for (AbstractField<PropertysetItem> field : fields) {
if (isEmpty()) {
isValid = false;
}
}
}
return isValid;
}
|
|
Project:
|
Magnolia UI
|
|
Labels:
|
support
|
|
Priority:
|
Neutral
|
|
Reporter:
|
Christian Ringele
|
|
|
|
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]>
----------------------------------------------------------------