Skip to content

Commit cc10071

Browse files
committed
Fixes for dropdown and checkboxes fields
1 parent f9d1af8 commit cc10071

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

wagtail_advanced_form_builder/forms/advanced_form_builder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create_html_field(self, field, options):
3535

3636
def create_dropdown_field(self, field, options):
3737
options['choices'] = list(map(
38-
lambda x: (x.strip(), x.strip()),
38+
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
3939
field.choices
4040
))
4141
if field.empty_label:
@@ -45,11 +45,12 @@ def create_dropdown_field(self, field, options):
4545

4646
def create_checkboxes_field(self, field, options):
4747
options['choices'] = list(map(
48-
lambda x: (x.strip(), x.strip()),
48+
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
4949
field.choices
5050
))
51+
5152
options['initial'] = list(map(
52-
lambda x: (x.strip(), x.strip()),
53+
lambda x: x.get('value', '').strip(),
5354
field.default_value
5455
))
5556

0 commit comments

Comments
 (0)