Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Commit

Permalink
Merge 59c4235 into d8b41be
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-moola committed Jul 30, 2018
2 parents d8b41be + 59c4235 commit a33b387
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions molo/surveys/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,27 @@ def clean(self):
'Options: a True and False'),
)
elif data['field_type'] in VALID_SKIP_LOGIC:
choice_max_length = 0
for i, logic in enumerate(data['skip_logic']):
if not logic.value['choice']:
self.add_stream_field_error(
i,
'choice',
_('This field is required.'),
)
else:
choice_max_length += len(logic.value['choice'])

if choice_max_length > CHARACTER_COUNT_CHOICE_LIMIT:
err = 'The combined choices\' maximum characters ' \
'limit has been exceeded ({max_limit} '\
'character(s)).'

self.add_form_field_error(
'field_type',
_(err).format(
max_length=CHARACTER_COUNT_CHOICE_LIMIT),
)

for i, logic in enumerate(data['skip_logic']):
if logic.value['skip_logic'] == SkipState.SURVEY:
Expand Down

0 comments on commit a33b387

Please sign in to comment.