Skip to content

Commit c94cef2

Browse files
authored
Merge pull request #3 from typecode/field-fixes
Fixes for dropdown and checkboxes fields
2 parents b33e80d + cc10071 commit c94cef2

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
@@ -36,7 +36,7 @@ def create_html_field(self, field, options):
3636

3737
def create_dropdown_field(self, field, options):
3838
options['choices'] = list(map(
39-
lambda x: (x.strip(), x.strip()),
39+
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
4040
field.choices
4141
))
4242
if field.empty_label:
@@ -46,11 +46,12 @@ def create_dropdown_field(self, field, options):
4646

4747
def create_checkboxes_field(self, field, options):
4848
options['choices'] = list(map(
49-
lambda x: (x.strip(), x.strip()),
49+
lambda x: (x.get('value', '').strip(), x.get('value', '').strip()),
5050
field.choices
5151
))
52+
5253
options['initial'] = list(map(
53-
lambda x: (x.strip(), x.strip()),
54+
lambda x: x.get('value', '').strip(),
5455
field.default_value
5556
))
5657

0 commit comments

Comments
 (0)