Fixes #536 - Group + Repeating property validation

For now, we should not allow both group and repeat properties on a field together.
This commit is contained in:
alicia pritchett 2021-11-09 13:21:44 -05:00
parent 9376d3deaf
commit accdd281fa
1 changed files with 5 additions and 0 deletions

View File

@ -258,6 +258,11 @@ class WorkflowService(object):
if field.has_property("read_only") and field.get_property(Task.FIELD_PROP_READ_ONLY).lower().strip() == "true":
continue # Don't mess about with read only fields.
if field.has_property(Task.FIELD_PROP_REPEAT) and field.has_property(Task.FIELD_PROP_GROUP):
raise ApiError.from_task("group_repeat", f'Fields cannot have both group and repeat properties. '
f' Please remove one of these properties. ',
task=task)
if field.has_property(Task.FIELD_PROP_REPEAT):
group = field.get_property(Task.FIELD_PROP_REPEAT)
if group in form_data and not(isinstance(form_data[group], list)):