diff --git a/.gitignore b/.gitignore index e55270f..730b07a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .idea .vscode /node_modules -/wagtail_advanced_form_builder/static npm-debug.log /dist wagtail_advanced_form_builder.egg-info diff --git a/build_test/models/home_page.py b/build_test/models/home_page.py index da86f69..625faa7 100644 --- a/build_test/models/home_page.py +++ b/build_test/models/home_page.py @@ -1,4 +1,4 @@ -from wagtail.core.models import Page +from wagtail.models import Page class HomePage(Page): diff --git a/build_test/settings/dev.py b/build_test/settings/dev.py index c771888..758aee9 100644 --- a/build_test/settings/dev.py +++ b/build_test/settings/dev.py @@ -29,7 +29,7 @@ 'wagtail.images', 'wagtail.search', 'wagtail.admin', - 'wagtail.core', + 'wagtail', 'wagtail.contrib.modeladmin', 'wagtail.contrib.settings', 'wagtail.contrib.routable_page', diff --git a/build_test/urls.py b/build_test/urls.py index 1336fcd..726c909 100644 --- a/build_test/urls.py +++ b/build_test/urls.py @@ -2,7 +2,7 @@ from django.urls import include, re_path from wagtail.admin import urls as wagtailadmin_urls -from wagtail.core import urls as wagtail_urls +from wagtail import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls urlpatterns = [] diff --git a/wagtail_advanced_form_builder/blocks/base_static_block.py b/wagtail_advanced_form_builder/blocks/base_static_block.py index b35f9c9..b700f64 100644 --- a/wagtail_advanced_form_builder/blocks/base_static_block.py +++ b/wagtail_advanced_form_builder/blocks/base_static_block.py @@ -1,6 +1,6 @@ from django.template.loader import render_to_string -from wagtail.core import blocks +from wagtail import blocks class BaseStaticBlock(blocks.StaticBlock): diff --git a/wagtail_advanced_form_builder/blocks/fields/base_field_block.py b/wagtail_advanced_form_builder/blocks/fields/base_field_block.py index ec77b24..61ebcee 100644 --- a/wagtail_advanced_form_builder/blocks/fields/base_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/base_field_block.py @@ -1,30 +1,27 @@ from django import forms from django.templatetags.static import static -from wagtail.core import blocks -from wagtail.core.blocks import RichTextBlock +from wagtail import blocks +from wagtail.blocks import RichTextBlock from .conditional_block import ConditionalBlock class BaseFieldBlock(blocks.StructBlock): - label = blocks.CharBlock( - max_length=255, - required=True, - help_text='The label of the form field.' + max_length=255, required=True, help_text="The label of the form field." ) required = blocks.BooleanBlock( default=False, required=False, - help_text='Tick this box to make this a required field.' + help_text="Tick this box to make this a required field.", ) display_checkbox_label = blocks.BooleanBlock( default=False, required=False, - help_text='Do you want the checkbox label to display? If not you should populate help_text.' + help_text="Do you want the checkbox label to display? If not you should populate help_text.", ) choices = blocks.ListBlock( @@ -39,14 +36,25 @@ class BaseFieldBlock(blocks.StructBlock): ) max_length = blocks.IntegerBlock( - required=False, - help_text='Set a maximum length for this field. e.g. 100' + required=False, help_text="Set a maximum length for this field. e.g. 100" + ) + + min_length = blocks.IntegerBlock( + required=False, help_text="Set a minimum length for this field. e.g. 2" ) default_value = blocks.CharBlock( + max_length=255, required=False, help_text="Set a default value for this field." + ) + salesforce_object_name = blocks.CharBlock( + max_length=255, + required=False, + help_text="The Salesforce object name that the form field value will be integrated to.", + ) + salesforce_api_field_name = blocks.CharBlock( max_length=255, required=False, - help_text='Set a default value for this field.' + help_text="The Salesforce API field name that the form field value will be integrated to.", ) # placeholder = blocks.CharBlock( @@ -58,7 +66,7 @@ class BaseFieldBlock(blocks.StructBlock): help_text = blocks.CharBlock( max_length=255, required=False, - help_text='Text to assist the user in populating this field.' + help_text="Text to assist the user in populating this field.", ) html = RichTextBlock( @@ -66,15 +74,15 @@ class BaseFieldBlock(blocks.StructBlock): ) display_side_by_side = blocks.BooleanBlock( - help_text='Display these items side by side?', + help_text="Display these items side by side?", required=False, ) rules = ConditionalBlock( required=False, - help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.' + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", ) @property def media(self): - return forms.Media(js=[static('wagtail_advanced_form_builder/js/admin.js')]) + return forms.Media(js=[static("wagtail_advanced_form_builder/js/admin.js")]) diff --git a/wagtail_advanced_form_builder/blocks/fields/blank_condition_block.py b/wagtail_advanced_form_builder/blocks/fields/blank_condition_block.py index f229fa8..cf9466f 100644 --- a/wagtail_advanced_form_builder/blocks/fields/blank_condition_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/blank_condition_block.py @@ -1,6 +1,6 @@ import wagtail_advanced_form_builder.constants as consts -from wagtail.core import blocks +from wagtail import blocks from .condition_block import ConditionBlock diff --git a/wagtail_advanced_form_builder/blocks/fields/checkbox_field_block.py b/wagtail_advanced_form_builder/blocks/fields/checkbox_field_block.py index 79ef3a3..ea6da1a 100644 --- a/wagtail_advanced_form_builder/blocks/fields/checkbox_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/checkbox_field_block.py @@ -1,10 +1,9 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class CheckboxFieldBlock(BaseFieldBlock): - choices = None help_text = blocks.CharBlock( @@ -14,18 +13,15 @@ class CheckboxFieldBlock(BaseFieldBlock): html = None - default_value = None - display_side_by_side = None empty_label = None max_length = None + min_length = None placeholder = None - class Meta: - - form_classname = 'waf--field' - icon = 'extraicons--checkbox' + form_classname = "waf--field" + icon = "extraicons--checkbox" diff --git a/wagtail_advanced_form_builder/blocks/fields/checkboxes_field_block.py b/wagtail_advanced_form_builder/blocks/fields/checkboxes_field_block.py index 98bfc25..f2dc221 100644 --- a/wagtail_advanced_form_builder/blocks/fields/checkboxes_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/checkboxes_field_block.py @@ -1,22 +1,21 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class CheckboxesFieldBlock(BaseFieldBlock): - choices = blocks.ListBlock( blocks.TextBlock( required=True, - icon='extraicons--heading-icon', + icon="extraicons--heading-icon", ), ) default_value = blocks.ListBlock( blocks.TextBlock( required=False, - icon='extraicons--heading-icon', - help_text='Enter a value that matches a checkbox choice above to have it ticked by default.' + icon="extraicons--heading-icon", + help_text="Enter a value that matches a checkbox choice above to have it ticked by default.", ), ) @@ -25,11 +24,12 @@ class CheckboxesFieldBlock(BaseFieldBlock): empty_label = None max_length = None + min_length = None placeholder = None display_checkbox_label = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--checkboxes' + form_classname = "waf--field" + icon = "extraicons--checkboxes" diff --git a/wagtail_advanced_form_builder/blocks/fields/condition_block.py b/wagtail_advanced_form_builder/blocks/fields/condition_block.py index 4968539..bfa17df 100644 --- a/wagtail_advanced_form_builder/blocks/fields/condition_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/condition_block.py @@ -1,6 +1,6 @@ import wagtail_advanced_form_builder.constants as consts -from wagtail.core import blocks +from wagtail import blocks class ConditionBlock(blocks.StructBlock): diff --git a/wagtail_advanced_form_builder/blocks/fields/conditional_block.py b/wagtail_advanced_form_builder/blocks/fields/conditional_block.py index 7d5c7a8..76eb63d 100644 --- a/wagtail_advanced_form_builder/blocks/fields/conditional_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/conditional_block.py @@ -1,6 +1,6 @@ import wagtail_advanced_form_builder.constants as consts -from wagtail.core import blocks +from wagtail import blocks from .condition_block import ConditionBlock from .blank_condition_block import BlankConditionBlock diff --git a/wagtail_advanced_form_builder/blocks/fields/dropdown_field_block.py b/wagtail_advanced_form_builder/blocks/fields/dropdown_field_block.py index c94d9e8..e3e601a 100644 --- a/wagtail_advanced_form_builder/blocks/fields/dropdown_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/dropdown_field_block.py @@ -1,20 +1,20 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class DropdownFieldBlock(BaseFieldBlock): - choices = blocks.ListBlock( blocks.TextBlock( required=True, - icon='extraicons--heading-icon', + icon="extraicons--heading-icon", ), ) html = None max_length = None + min_length = None placeholder = None @@ -23,5 +23,5 @@ class DropdownFieldBlock(BaseFieldBlock): display_checkbox_label = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--dropdown' + form_classname = "waf--field" + icon = "extraicons--dropdown" diff --git a/wagtail_advanced_form_builder/blocks/fields/field_toggle_block.py b/wagtail_advanced_form_builder/blocks/fields/field_toggle_block.py new file mode 100644 index 0000000..f3b1187 --- /dev/null +++ b/wagtail_advanced_form_builder/blocks/fields/field_toggle_block.py @@ -0,0 +1,12 @@ +from wagtail import blocks + +from .checkbox_field_block import CheckboxFieldBlock + + +class FieldToggleBlock(CheckboxFieldBlock): + name = blocks.CharBlock( + max_length=255, required=False, help_text="The field name to be used in the code" + ) + toggled_label = blocks.CharBlock( + max_length=255, required=False, help_text="The label to display when toggled" + ) diff --git a/wagtail_advanced_form_builder/blocks/fields/hidden_field_block.py b/wagtail_advanced_form_builder/blocks/fields/hidden_field_block.py index 345f53d..50ac0cc 100644 --- a/wagtail_advanced_form_builder/blocks/fields/hidden_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/hidden_field_block.py @@ -1,15 +1,14 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class HiddenFieldBlock(BaseFieldBlock): - default_value = blocks.CharBlock( max_length=255, required=True, - label='Value', - help_text='The value to go into the hidden field.' + label="Value", + help_text="The value to go into the hidden field.", ) choices = None @@ -25,6 +24,7 @@ class HiddenFieldBlock(BaseFieldBlock): empty_label = None max_length = None + min_length = None display_side_by_side = None @@ -33,6 +33,5 @@ class HiddenFieldBlock(BaseFieldBlock): rules = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--hidden' - + form_classname = "waf--field" + icon = "extraicons--hidden" diff --git a/wagtail_advanced_form_builder/blocks/fields/html_field_block.py b/wagtail_advanced_form_builder/blocks/fields/html_field_block.py index cee1a67..5cf8b11 100644 --- a/wagtail_advanced_form_builder/blocks/fields/html_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/html_field_block.py @@ -1,16 +1,15 @@ -from wagtail.core import blocks -from wagtail.core.blocks import RichTextBlock +from wagtail import blocks +from wagtail.blocks import RichTextBlock from .base_field_block import BaseFieldBlock class HTMLFieldBlock(BaseFieldBlock): - label = blocks.CharBlock( max_length=255, required=True, - help_text='A unique reference for this html block', - label='Unique reference name', + help_text="A unique reference for this html block", + label="Unique reference name", ) html = RichTextBlock( @@ -20,6 +19,7 @@ class HTMLFieldBlock(BaseFieldBlock): help_text = None max_length = None + min_length = None required = None @@ -36,7 +36,5 @@ class HTMLFieldBlock(BaseFieldBlock): display_checkbox_label = None class Meta: - form_classname = 'waf--field waf--html-field' - icon = 'extraicons--paragraph' - - + form_classname = "waf--field waf--html-field" + icon = "extraicons--paragraph" diff --git a/wagtail_advanced_form_builder/blocks/fields/multi_line_field_block.py b/wagtail_advanced_form_builder/blocks/fields/multi_line_field_block.py index 1980118..6e11d4a 100644 --- a/wagtail_advanced_form_builder/blocks/fields/multi_line_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/multi_line_field_block.py @@ -2,7 +2,6 @@ class MultiLineFieldBlock(BaseFieldBlock): - choices = None html = None @@ -14,11 +13,12 @@ class MultiLineFieldBlock(BaseFieldBlock): empty_label = None max_length = None + min_length = None display_side_by_side = None placeholder = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--text-box' + form_classname = "waf--field" + icon = "extraicons--text-box" diff --git a/wagtail_advanced_form_builder/blocks/fields/multiselect_field_block.py b/wagtail_advanced_form_builder/blocks/fields/multiselect_field_block.py index ea1a905..b8147e9 100644 --- a/wagtail_advanced_form_builder/blocks/fields/multiselect_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/multiselect_field_block.py @@ -1,14 +1,13 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class MultiSelectFieldBlock(BaseFieldBlock): - choices = blocks.ListBlock( blocks.TextBlock( required=True, - icon='extraicons--heading-icon', + icon="extraicons--heading-icon", ), ) @@ -21,9 +20,10 @@ class MultiSelectFieldBlock(BaseFieldBlock): empty_label = None max_length = None + min_length = None display_side_by_side = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--multi-select' + form_classname = "waf--field" + icon = "extraicons--multi-select" diff --git a/wagtail_advanced_form_builder/blocks/fields/number_field_block.py b/wagtail_advanced_form_builder/blocks/fields/number_field_block.py index 2290e10..f65894b 100644 --- a/wagtail_advanced_form_builder/blocks/fields/number_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/number_field_block.py @@ -2,7 +2,6 @@ class NumberFieldBlock(BaseFieldBlock): - choices = None html = None @@ -16,7 +15,8 @@ class NumberFieldBlock(BaseFieldBlock): placeholder = None max_length = None + min_length = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--number' + form_classname = "waf--field" + icon = "extraicons--number" diff --git a/wagtail_advanced_form_builder/blocks/fields/radio_field_block.py b/wagtail_advanced_form_builder/blocks/fields/radio_field_block.py index 82ece04..6958895 100644 --- a/wagtail_advanced_form_builder/blocks/fields/radio_field_block.py +++ b/wagtail_advanced_form_builder/blocks/fields/radio_field_block.py @@ -1,14 +1,13 @@ -from wagtail.core import blocks +from wagtail import blocks from .base_field_block import BaseFieldBlock class RadioFieldBlock(BaseFieldBlock): - choices = blocks.ListBlock( blocks.TextBlock( required=True, - icon='extraicons--heading-icon', + icon="extraicons--heading-icon", ), ) @@ -17,11 +16,12 @@ class RadioFieldBlock(BaseFieldBlock): empty_label = None max_length = None + min_length = None placeholder = None display_checkbox_label = None class Meta: - form_classname = 'waf--field' - icon = 'extraicons--radio' + form_classname = "waf--field" + icon = "extraicons--radio" diff --git a/wagtail_advanced_form_builder/constants.py b/wagtail_advanced_form_builder/constants.py index b344a0d..0422f33 100644 --- a/wagtail_advanced_form_builder/constants.py +++ b/wagtail_advanced_form_builder/constants.py @@ -1,54 +1,56 @@ from django.utils.translation import gettext_lazy as _ -FIELD_TYPE_SINGLE_LINE = 'singleline' -FIELD_TYPE_MULTI_LINE = 'multiline' -FIELD_TYPE_EMAIL = 'email' -FIELD_TYPE_NUMBER = 'number' -FIELD_TYPE_URL = 'url' -FIELD_TYPE_CHECKBOX = 'checkbox' -FIELD_TYPE_CHECKBOXES = 'checkboxes' -FIELD_TYPE_DROPDOWN = 'dropdown' -FIELD_TYPE_MULTI_SELECT = 'multiselect' -FIELD_TYPE_RADIO = 'radio' -FIELD_TYPE_DATE = 'date' -FIELD_TYPE_HIDDEN = 'hidden' -FIELD_TYPE_HTML = 'html' -FIELD_TYPE_CURRENCY = 'currency' -FIELD_TYPE_SIMPLE_DATE = 'simpledate' -FIELD_TYPE_PHONE = 'phone' +FIELD_TYPE_SINGLE_LINE = "singleline" +FIELD_TYPE_MULTI_LINE = "multiline" +FIELD_TYPE_EMAIL = "email" +FIELD_TYPE_NUMBER = "number" +FIELD_TYPE_URL = "url" +FIELD_TYPE_CHECKBOX = "checkbox" +FIELD_TYPE_CHECKBOXES = "checkboxes" +FIELD_TYPE_DROPDOWN = "dropdown" +FIELD_TYPE_ALTERNATIVE_EMAIL_DROPDOWN = "alternative_email_dropdown" +FIELD_TYPE_MULTI_SELECT = "multiselect" +FIELD_TYPE_RADIO = "radio" +FIELD_TYPE_DATE = "date" +FIELD_TYPE_HIDDEN = "hidden" +FIELD_TYPE_HTML = "html" +FIELD_TYPE_CURRENCY = "currency" +FIELD_TYPE_SIMPLE_DATE = "simpledate" +FIELD_TYPE_PHONE = "phone" +FIELD_TYPE_FIELD_TOGGLE = "field_toggle" -FIELD_RULE_IS = 'is' -FIELD_RULE_IS_NOT = 'is_not' -FIELD_RULE_GREATER_THAN = 'greater_than' -FIELD_RULE_GREATER_THAN_OR_EQUAL = 'greater_than_equal' -FIELD_RULE_LESS_THAN = 'less_than' -FIELD_RULE_LESS_THAN_OR_EQUAL = 'less_than_equal' -FIELD_RULE_CONTAINS = 'contains' -FIELD_RULE_STARTS_WITH = 'starts-with' -FIELD_RULE_ENDS_WITH = 'ends-with' -FIELD_RULE_IS_BLANK = 'is_blank' -FIELD_RULE_IS_NOT_BLANK = 'is_not_blank' +FIELD_RULE_IS = "is" +FIELD_RULE_IS_NOT = "is_not" +FIELD_RULE_GREATER_THAN = "greater_than" +FIELD_RULE_GREATER_THAN_OR_EQUAL = "greater_than_equal" +FIELD_RULE_LESS_THAN = "less_than" +FIELD_RULE_LESS_THAN_OR_EQUAL = "less_than_equal" +FIELD_RULE_CONTAINS = "contains" +FIELD_RULE_STARTS_WITH = "starts-with" +FIELD_RULE_ENDS_WITH = "ends-with" +FIELD_RULE_IS_BLANK = "is_blank" +FIELD_RULE_IS_NOT_BLANK = "is_not_blank" FIELD_RULE_CHOICES = ( - (FIELD_RULE_IS, _('Is equal to')), - (FIELD_RULE_IS_NOT, _('Is not equal to')), - (FIELD_RULE_GREATER_THAN, _('Greater than')), - (FIELD_RULE_GREATER_THAN_OR_EQUAL, _('Greater than or equal to')), - (FIELD_RULE_LESS_THAN, _('Less than')), - (FIELD_RULE_LESS_THAN_OR_EQUAL, _('Less than or equal to')), - (FIELD_RULE_CONTAINS, _('Contains')), - (FIELD_RULE_STARTS_WITH, _('Starts with')), - (FIELD_RULE_ENDS_WITH, _('Ends with')), + (FIELD_RULE_IS, _("Is equal to")), + (FIELD_RULE_IS_NOT, _("Is not equal to")), + (FIELD_RULE_GREATER_THAN, _("Greater than")), + (FIELD_RULE_GREATER_THAN_OR_EQUAL, _("Greater than or equal to")), + (FIELD_RULE_LESS_THAN, _("Less than")), + (FIELD_RULE_LESS_THAN_OR_EQUAL, _("Less than or equal to")), + (FIELD_RULE_CONTAINS, _("Contains")), + (FIELD_RULE_STARTS_WITH, _("Starts with")), + (FIELD_RULE_ENDS_WITH, _("Ends with")), ) FIELD_RULE_CHOICES_BLANK = ( - (FIELD_RULE_IS_BLANK, _('Is blank')), - (FIELD_RULE_IS_NOT_BLANK, _('Is not blank')), + (FIELD_RULE_IS_BLANK, _("Is blank")), + (FIELD_RULE_IS_NOT_BLANK, _("Is not blank")), ) -FIELD_ACTION_SHOW = 'show' -FIELD_ACTION_HIDE = 'hide' +FIELD_ACTION_SHOW = "show" +FIELD_ACTION_HIDE = "hide" FIELD_ACTION_CHOICES = ( - (FIELD_ACTION_SHOW, _('Show')), - (FIELD_ACTION_HIDE, _('Hide')), + (FIELD_ACTION_SHOW, _("Show")), + (FIELD_ACTION_HIDE, _("Hide")), ) diff --git a/wagtail_advanced_form_builder/forms/advanced_form_builder.py b/wagtail_advanced_form_builder/forms/advanced_form_builder.py index 7ef0bee..d558700 100644 --- a/wagtail_advanced_form_builder/forms/advanced_form_builder.py +++ b/wagtail_advanced_form_builder/forms/advanced_form_builder.py @@ -2,57 +2,79 @@ from wagtail.contrib.forms.forms import FormBuilder -from wagtail_advanced_form_builder.forms.widgets.checkbox_input_widget import CheckboxInput -from wagtail_advanced_form_builder.forms.widgets.html_output_widget import HTMLOutputWidget -from wagtail_advanced_form_builder.forms.widgets.side_by_side_checkbox_select_multiple_widget import \ - SideBySideCheckboxSelectWidget -from wagtail_advanced_form_builder.forms.widgets.side_by_side_radio_select_widget import SideBySideRadioSelectWidget +from wagtail_advanced_form_builder.forms.widgets.checkbox_input_widget import ( + CheckboxInput, +) +from wagtail_advanced_form_builder.forms.widgets.field_toggle_widget import ( + FieldToggleInput, +) +from wagtail_advanced_form_builder.forms.widgets.html_output_widget import ( + HTMLOutputWidget, +) +from wagtail_advanced_form_builder.forms.widgets.side_by_side_checkbox_select_multiple_widget import ( + SideBySideCheckboxSelectWidget, +) +from wagtail_advanced_form_builder.forms.widgets.side_by_side_radio_select_widget import ( + SideBySideRadioSelectWidget, +) class AdvancedFormBuilder(FormBuilder): - def create_singleline_field(self, field, options): if field.max_length: - options['max_length'] = field.max_length + options["max_length"] = field.max_length else: - options['max_length'] = 255 + options["max_length"] = 255 + if field.min_length: + options["min_length"] = field.min_length + return forms.CharField(**options) def create_email_field(self, field, options): if field.max_length: - options['max_length'] = field.max_length + options["max_length"] = field.max_length + if field.min_length: + options["min_length"] = field.min_length + return forms.EmailField(**options) def create_url_field(self, field, options): if field.max_length: - options['max_length'] = field.max_length + options["max_length"] = field.max_length + if field.min_length: + options["min_length"] = field.min_length + return forms.URLField(**options) def create_html_field(self, field, options): - options['widget'] = HTMLOutputWidget( + options["widget"] = HTMLOutputWidget( html_value=field.html_value, ) return forms.Field(**options) def create_dropdown_field(self, field, options): - options['choices'] = list(map( - lambda x: (x.strip(), x.strip()), - field.choices - )) + options["choices"] = list( + map( + lambda x: (x.get("value", "").strip(), x.get("value", "").strip()), + field.choices, + ) + ) if field.empty_label: - options['choices'] = [('', field.empty_label)] + options['choices'] + options["choices"] = [("", field.empty_label)] + options["choices"] return forms.ChoiceField(**options) def create_checkboxes_field(self, field, options): - options['choices'] = list(map( - lambda x: (x.strip(), x.strip()), - field.choices - )) - options['initial'] = list(map( - lambda x: (x.strip(), x.strip()), - field.default_value - )) + options["choices"] = list( + map( + lambda x: (x.get("value", "").strip(), x.get("value", "").strip()), + field.choices, + ) + ) + + options["initial"] = list( + map(lambda x: x.get("value", "").strip(), field.default_value) + ) if field.display_side_by_side: return forms.MultipleChoiceField( @@ -64,30 +86,36 @@ def create_checkboxes_field(self, field, options): ) def create_checkbox_field(self, field, options): - options['widget'] = CheckboxInput( + options["widget"] = CheckboxInput( display_checkbox_label=field.display_checkbox_label ) return forms.BooleanField(**options) - def create_radio_field(self, field, options): - - options['choices'] = list(map( - lambda x: (x.strip(), x.strip()), - field.choices - )) + options["choices"] = list( + map( + lambda x: (x.strip(), x.strip()), + map(lambda x: x["value"] if type(x) is dict else x, field.choices), + ) + ) if field.display_side_by_side: return forms.ChoiceField(widget=SideBySideRadioSelectWidget, **options) else: return forms.ChoiceField(widget=forms.RadioSelect, **options) - def create_multiselect_field(self, field, options): - options['choices'] = list(map( - lambda x: (x.strip(), x.strip()), - field.choices - )) + options["choices"] = list( + map( + lambda x: (x.strip(), x.strip()), + map(lambda x: x["value"] if type(x) is dict else x, field.choices), + ) + ) return forms.MultipleChoiceField(**options) - + def create_field_toggle_field(self, field, options): + options["widget"] = FieldToggleInput( + attrs={"data-toggled-label": field.toggled_label, "data-label": field.label} + ) + field_toggle = forms.BooleanField(**options) + return field_toggle diff --git a/wagtail_advanced_form_builder/forms/widgets/checkbox_input_widget.py b/wagtail_advanced_form_builder/forms/widgets/checkbox_input_widget.py index 742c96d..b58104b 100644 --- a/wagtail_advanced_form_builder/forms/widgets/checkbox_input_widget.py +++ b/wagtail_advanced_form_builder/forms/widgets/checkbox_input_widget.py @@ -3,7 +3,7 @@ class CheckboxInput(DjangoCheckboxInput): - def __init__(self, display_checkbox_label=False, *args, **kwargs): + def __init__(self, display_checkbox_label=True, *args, **kwargs): super().__init__(*args, **kwargs) self.display_checkbox_label = display_checkbox_label diff --git a/wagtail_advanced_form_builder/forms/widgets/field_toggle_widget.py b/wagtail_advanced_form_builder/forms/widgets/field_toggle_widget.py new file mode 100644 index 0000000..b2675d1 --- /dev/null +++ b/wagtail_advanced_form_builder/forms/widgets/field_toggle_widget.py @@ -0,0 +1,23 @@ +from django.forms import CheckboxInput, Media + + +class FieldToggleInput(CheckboxInput): + template_name = "wagtail_advanced_form_builder/widgets/field_toggle_widget.html" + + def get_context(self, name, value, attrs): + context = super().get_context(name, value, attrs) + context["widget"]["label"] = context["widget"]["attrs"]["data-label"] + context["widget"]["toggled_label"] = context["widget"]["attrs"][ + "data-toggled-label" + ] + context["widget"]["id_for_label"] = context["widget"]["attrs"]["id"] + return context + + @property + def media(self): + css = {} + js = ["wagtail_advanced_form_builder/js/field-toggle-widget.js"] + return Media(css=css, js=js) + + def value_from_datadict(self, data, files, name): + return super().value_from_datadict(data, files, name) diff --git a/wagtail_advanced_form_builder/migrations/0001_initial.py b/wagtail_advanced_form_builder/migrations/0001_initial.py index ea8ad0c..6d03c22 100644 --- a/wagtail_advanced_form_builder/migrations/0001_initial.py +++ b/wagtail_advanced_form_builder/migrations/0001_initial.py @@ -3,8 +3,8 @@ from django.db import migrations, models import django.db.models.deletion import modelcluster.fields -import wagtail.core.blocks -import wagtail.core.fields +import wagtail.blocks +import wagtail.fields class Migration(migrations.Migration): @@ -23,9 +23,9 @@ class Migration(migrations.Migration): ('to_address', models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address')), ('from_address', models.CharField(blank=True, max_length=255, verbose_name='from address')), ('subject', models.CharField(blank=True, max_length=255, verbose_name='subject')), - ('form', wagtail.core.fields.StreamField([('singleline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.core.blocks.RichTextBlock(required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=True))), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.core.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.core.blocks.CharBlock(max_length=255, required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Hidden field')), ('number', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True)), + ('form', wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=True))), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(max_length=255, required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True)), ('thanks_page_title', models.CharField(blank=True, default=None, help_text='The title for the thanks page. Defaults to the normal page title if left blank.', max_length=150, null=True)), - ('thanks_page_content', wagtail.core.fields.RichTextField(default=None, help_text='Content to display on the form thank you page.', null=True)), + ('thanks_page_content', wagtail.fields.RichTextField(default=None, help_text='Content to display on the form thank you page.', null=True)), ('submit_button_text', models.CharField(default='Submit', help_text='The text to display on the form submission button', max_length=30)), ('use_browser_validation', models.BooleanField(blank=True, default=False, help_text='Tick this to use the in-built browser validation on fields')), ], @@ -38,9 +38,9 @@ class Migration(migrations.Migration): name='FormPage', fields=[ ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), - ('form', wagtail.core.fields.StreamField([('singleline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.core.blocks.RichTextBlock(required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=True))), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.core.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.core.blocks.CharBlock(max_length=255, required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Hidden field')), ('number', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True)), + ('form', wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=True))), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(max_length=255, required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True)), ('thanks_page_title', models.CharField(blank=True, default=None, help_text='The title for the thanks page. Defaults to the normal page title if left blank.', max_length=150, null=True)), - ('thanks_page_content', wagtail.core.fields.RichTextField(default=None, help_text='Content to display on the form thank you page.', null=True)), + ('thanks_page_content', wagtail.fields.RichTextField(default=None, help_text='Content to display on the form thank you page.', null=True)), ('submit_button_text', models.CharField(default='Submit', help_text='The text to display on the form submission button', max_length=30)), ('use_browser_validation', models.BooleanField(blank=True, default=False, help_text='Tick this to use the in-built browser validation on fields')), ], @@ -61,7 +61,7 @@ class Migration(migrations.Migration): ('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')), ('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('multiselect', 'Multiple select'), ('radio', 'Radio buttons'), ('date', 'Date'), ('hidden', 'Hidden field'), ('currency', 'Currency field'), ('simpledate', 'Date'), ('phone', 'Phone')], max_length=16, verbose_name='field type')), ('rule_action', models.CharField(blank=True, choices=[('show', 'Show'), ('hide', 'Hide')], default='', max_length=10)), - ('html_value', wagtail.core.fields.RichTextField(blank=True, default=None, null=True)), + ('html_value', wagtail.fields.RichTextField(blank=True, default=None, null=True)), ('max_length', models.IntegerField(blank=True, default=None, null=True)), ('empty_label', models.CharField(blank=True, default=None, max_length=255, null=True)), ('display_side_by_side', models.BooleanField(default=False)), @@ -84,7 +84,7 @@ class Migration(migrations.Migration): ('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')), ('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('multiselect', 'Multiple select'), ('radio', 'Radio buttons'), ('date', 'Date'), ('hidden', 'Hidden field'), ('currency', 'Currency field'), ('simpledate', 'Date'), ('phone', 'Phone')], max_length=16, verbose_name='field type')), ('rule_action', models.CharField(blank=True, choices=[('show', 'Show'), ('hide', 'Hide')], default='', max_length=10)), - ('html_value', wagtail.core.fields.RichTextField(blank=True, default=None, null=True)), + ('html_value', wagtail.fields.RichTextField(blank=True, default=None, null=True)), ('max_length', models.IntegerField(blank=True, default=None, null=True)), ('empty_label', models.CharField(blank=True, default=None, max_length=255, null=True)), ('display_side_by_side', models.BooleanField(default=False)), diff --git a/wagtail_advanced_form_builder/migrations/0002_auto_20201116_2241.py b/wagtail_advanced_form_builder/migrations/0002_auto_20201116_2241.py index de826e6..c8fab18 100644 --- a/wagtail_advanced_form_builder/migrations/0002_auto_20201116_2241.py +++ b/wagtail_advanced_form_builder/migrations/0002_auto_20201116_2241.py @@ -1,8 +1,8 @@ # Generated by Django 2.2.17 on 2020-11-16 09:41 from django.db import migrations -import wagtail.core.blocks -import wagtail.core.fields +import wagtail.blocks +import wagtail.fields class Migration(migrations.Migration): @@ -15,11 +15,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='emailformpage', name='form', - field=wagtail.core.fields.StreamField([('singleline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.core.blocks.RichTextBlock(required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.core.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.core.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True))], label='Hidden field')), ('number', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True), + field=wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True), ), migrations.AlterField( model_name='formpage', name='form', - field=wagtail.core.fields.StreamField([('singleline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.core.blocks.RichTextBlock(required=True)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.core.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.core.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.core.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.core.blocks.ListBlock(wagtail.core.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.core.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.core.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True))], label='Hidden field')), ('number', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.core.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.core.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.core.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.core.blocks.StructBlock([('action', wagtail.core.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.core.blocks.StreamBlock([('condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.core.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.core.blocks.StructBlock([('field_name', wagtail.core.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.core.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True), + field=wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True), ), ] diff --git a/wagtail_advanced_form_builder/migrations/0003_auto_20230706_2006.py b/wagtail_advanced_form_builder/migrations/0003_auto_20230706_2006.py new file mode 100644 index 0000000..716dd87 --- /dev/null +++ b/wagtail_advanced_form_builder/migrations/0003_auto_20230706_2006.py @@ -0,0 +1,56 @@ +# Generated by Django 3.2.13 on 2023-07-06 20:06 + +from django.db import migrations, models +import wagtail.blocks +import wagtail.contrib.forms.models +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtail_advanced_form_builder', '0002_auto_20201116_2241'), + ] + + operations = [ + migrations.AlterField( + model_name='emailformfield', + name='choices', + field=models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices'), + ), + migrations.AlterField( + model_name='emailformfield', + name='default_value', + field=models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value'), + ), + migrations.AlterField( + model_name='emailformpage', + name='form', + field=wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True, use_json_field=None), + ), + migrations.AlterField( + model_name='emailformpage', + name='from_address', + field=models.EmailField(blank=True, max_length=255, verbose_name='from address'), + ), + migrations.AlterField( + model_name='emailformpage', + name='to_address', + field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, validators=[wagtail.contrib.forms.models.validate_to_address], verbose_name='to address'), + ), + migrations.AlterField( + model_name='formfield', + name='choices', + field=models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices'), + ), + migrations.AlterField( + model_name='formfield', + name='default_value', + field=models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value'), + ), + migrations.AlterField( + model_name='formpage', + name='form', + field=wagtail.fields.StreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Basic field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Email field')), ('html', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='A unique reference for this html block', label='Unique reference name', max_length=255, required=True)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('html', wagtail.blocks.RichTextBlock(required=True)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='HTML')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('empty_label', wagtail.blocks.CharBlock(max_length=255, required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Radio field')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(help_text='Enter a value that matches a checkbox choice above to have it ticked by default.', icon='extraicons--heading-icon', required=False))), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('display_side_by_side', wagtail.blocks.BooleanBlock(help_text='Display these items side by side?', required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkboxes field')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('display_checkbox_label', wagtail.blocks.BooleanBlock(default=False, help_text='Do you want the checkbox label to display? If not you should populate help_text.', required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Checkbox field')), ('multiselect', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.TextBlock(icon='extraicons--heading-icon', required=True))), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiselect field')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Multiline field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('max_length', wagtail.blocks.IntegerBlock(help_text='Set a maximum length for this field. e.g. 100', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='URL field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('default_value', wagtail.blocks.CharBlock(help_text='The value to go into the hidden field.', label='Value', max_length=255, required=True)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False))], label='Hidden field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock(help_text='The label of the form field.', max_length=255, required=True)), ('required', wagtail.blocks.BooleanBlock(default=False, help_text='Tick this box to make this a required field.', required=False)), ('default_value', wagtail.blocks.CharBlock(help_text='Set a default value for this field.', max_length=255, required=False)), ('salesforce_object_name', wagtail.blocks.CharBlock(help_text='The Salesforce object name that the form field value will be integrated to.', max_length=255, required=False)), ('salesforce_api_field_name', wagtail.blocks.CharBlock(help_text='The Salesforce API field name that the form field value will be integrated to.', max_length=255, required=False)), ('help_text', wagtail.blocks.CharBlock(help_text='Text to assist the user in populating this field.', max_length=255, required=False)), ('rules', wagtail.blocks.StructBlock([('action', wagtail.blocks.ChoiceBlock(choices=[('show', 'Show'), ('hide', 'Hide')], help_text='What conditional action would you like to perform on this field?')), ('conditions', wagtail.blocks.StreamBlock([('condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is', 'Is equal to'), ('is_not', 'Is not equal to'), ('greater_than', 'Greater than'), ('greater_than_equal', 'Greater than or equal to'), ('less_than', 'Less than'), ('less_than_equal', 'Less than or equal to'), ('contains', 'Contains'), ('starts-with', 'Starts with'), ('ends-with', 'Ends with')])), ('value', wagtail.blocks.CharBlock(help_text='', max_length=255, required=True))])), ('blank_condition', wagtail.blocks.StructBlock([('field_name', wagtail.blocks.CharBlock(help_text='The name of a field in the form', max_length=255, required=True)), ('rule', wagtail.blocks.ChoiceBlock(choices=[('is_blank', 'Is blank'), ('is_not_blank', 'Is not blank')]))]))], required=False))], help_text='Add conditional rules to show or hide fields depending on the value of other fields in the form.', required=False))], label='Number field'))], default=None, help_text='Add fields to the form', null=True, use_json_field=None), + ), + ] diff --git a/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length.py b/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length.py new file mode 100644 index 0000000..bf59010 --- /dev/null +++ b/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.11 on 2024-05-02 19:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtail_advanced_form_builder", "0003_auto_20230706_2006"), + ] + + operations = [ + migrations.AddField( + model_name="emailformfield", + name="min_length", + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name="formfield", + name="min_length", + field=models.IntegerField(blank=True, default=None, null=True), + ), + ] diff --git a/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length_and_more.py.py b/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length_and_more.py.py new file mode 100644 index 0000000..ca77446 --- /dev/null +++ b/wagtail_advanced_form_builder/migrations/0004_emailformfield_min_length_formfield_min_length_and_more.py.py @@ -0,0 +1,4178 @@ +# Generated by Django 4.2.7 on 2023-11-16 12:07 + +from django.db import migrations, models +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + dependencies = [ + ("wagtail_advanced_form_builder", "0003_auto_20230706_2006"), + ] + + operations = [ + migrations.AddField( + model_name="emailformfield", + name="min_length", + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AddField( + model_name="formfield", + name="min_length", + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AlterField( + model_name="emailformpage", + name="form", + field=wagtail.fields.StreamField( + [ + ( + "singleline", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Basic field", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Email field", + ), + ), + ( + "html", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="A unique reference for this html block", + label="Unique reference name", + max_length=255, + required=True, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ("html", wagtail.blocks.RichTextBlock(required=True)), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="HTML", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "empty_label", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Dropdown field", + ), + ), + ( + "radio", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "display_side_by_side", + wagtail.blocks.BooleanBlock( + help_text="Display these items side by side?", + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Radio field", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + help_text="Enter a value that matches a checkbox choice above to have it ticked by default.", + icon="extraicons--heading-icon", + required=False, + ) + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "display_side_by_side", + wagtail.blocks.BooleanBlock( + help_text="Display these items side by side?", + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Checkboxes field", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "display_checkbox_label", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Do you want the checkbox label to display? If not you should populate help_text.", + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Checkbox field", + ), + ), + ( + "multiselect", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Multiselect field", + ), + ), + ( + "multiline", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Multiline field", + ), + ), + ( + "url", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="URL field", + ), + ), + ( + "hidden", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="The value to go into the hidden field.", + label="Value", + max_length=255, + required=True, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ], + label="Hidden field", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Number field", + ), + ), + ], + default=None, + help_text="Add fields to the form", + null=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="formpage", + name="form", + field=wagtail.fields.StreamField( + [ + ( + "singleline", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Basic field", + ), + ), + ( + "email", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Email field", + ), + ), + ( + "html", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="A unique reference for this html block", + label="Unique reference name", + max_length=255, + required=True, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ("html", wagtail.blocks.RichTextBlock(required=True)), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="HTML", + ), + ), + ( + "dropdown", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "empty_label", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Dropdown field", + ), + ), + ( + "radio", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "display_side_by_side", + wagtail.blocks.BooleanBlock( + help_text="Display these items side by side?", + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Radio field", + ), + ), + ( + "checkboxes", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + help_text="Enter a value that matches a checkbox choice above to have it ticked by default.", + icon="extraicons--heading-icon", + required=False, + ) + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "display_side_by_side", + wagtail.blocks.BooleanBlock( + help_text="Display these items side by side?", + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Checkboxes field", + ), + ), + ( + "checkbox", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "display_checkbox_label", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Do you want the checkbox label to display? If not you should populate help_text.", + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Checkbox field", + ), + ), + ( + "multiselect", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "choices", + wagtail.blocks.ListBlock( + wagtail.blocks.TextBlock( + icon="extraicons--heading-icon", + required=True, + ) + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Multiselect field", + ), + ), + ( + "multiline", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Multiline field", + ), + ), + ( + "url", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "max_length", + wagtail.blocks.IntegerBlock( + help_text="Set a maximum length for this field. e.g. 100", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="URL field", + ), + ), + ( + "hidden", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="The value to go into the hidden field.", + label="Value", + max_length=255, + required=True, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ], + label="Hidden field", + ), + ), + ( + "number", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="The label of the form field.", + max_length=255, + required=True, + ), + ), + ( + "required", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Tick this box to make this a required field.", + required=False, + ), + ), + ( + "default_value", + wagtail.blocks.CharBlock( + help_text="Set a default value for this field.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_object_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce object name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "salesforce_api_field_name", + wagtail.blocks.CharBlock( + help_text="The Salesforce API field name that the form field value will be integrated to.", + max_length=255, + required=False, + ), + ), + ( + "help_text", + wagtail.blocks.CharBlock( + help_text="Text to assist the user in populating this field.", + max_length=255, + required=False, + ), + ), + ( + "rules", + wagtail.blocks.StructBlock( + [ + ( + "action", + wagtail.blocks.ChoiceBlock( + choices=[ + ("show", "Show"), + ("hide", "Hide"), + ], + help_text="What conditional action would you like to perform on this field?", + ), + ), + ( + "conditions", + wagtail.blocks.StreamBlock( + [ + ( + "condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is", + "Is equal to", + ), + ( + "is_not", + "Is not equal to", + ), + ( + "greater_than", + "Greater than", + ), + ( + "greater_than_equal", + "Greater than or equal to", + ), + ( + "less_than", + "Less than", + ), + ( + "less_than_equal", + "Less than or equal to", + ), + ( + "contains", + "Contains", + ), + ( + "starts-with", + "Starts with", + ), + ( + "ends-with", + "Ends with", + ), + ] + ), + ), + ( + "value", + wagtail.blocks.CharBlock( + help_text="", + max_length=255, + required=True, + ), + ), + ] + ), + ), + ( + "blank_condition", + wagtail.blocks.StructBlock( + [ + ( + "field_name", + wagtail.blocks.CharBlock( + help_text="The name of a field in the form", + max_length=255, + required=True, + ), + ), + ( + "rule", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "is_blank", + "Is blank", + ), + ( + "is_not_blank", + "Is not blank", + ), + ] + ), + ), + ] + ), + ), + ], + required=False, + ), + ), + ], + help_text="Add conditional rules to show or hide fields depending on the value of other fields in the form.", + required=False, + ), + ), + ], + label="Number field", + ), + ), + ], + default=None, + help_text="Add fields to the form", + null=True, + use_json_field=True, + ), + ), + ] \ No newline at end of file diff --git a/wagtail_advanced_form_builder/migrations/0005_emailformfield_name_emailformfield_toggled_label_and_more.py b/wagtail_advanced_form_builder/migrations/0005_emailformfield_name_emailformfield_toggled_label_and_more.py new file mode 100644 index 0000000..ddc2e7d --- /dev/null +++ b/wagtail_advanced_form_builder/migrations/0005_emailformfield_name_emailformfield_toggled_label_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 4.2.11 on 2024-05-03 14:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "wagtail_advanced_form_builder", + "0004_emailformfield_min_length_formfield_min_length", + ), + ] + + operations = [ + migrations.AddField( + model_name="emailformfield", + name="name", + field=models.CharField(blank=True, max_length=255), + ), + migrations.AddField( + model_name="emailformfield", + name="toggled_label", + field=models.CharField(blank=True, max_length=255), + ), + migrations.AddField( + model_name="formfield", + name="name", + field=models.CharField(blank=True, max_length=255), + ), + migrations.AddField( + model_name="formfield", + name="toggled_label", + field=models.CharField(blank=True, max_length=255), + ), + ] diff --git a/wagtail_advanced_form_builder/models/abstract_advanced_email_form.py b/wagtail_advanced_form_builder/models/abstract_advanced_email_form.py index 92d44b9..9f494c9 100644 --- a/wagtail_advanced_form_builder/models/abstract_advanced_email_form.py +++ b/wagtail_advanced_form_builder/models/abstract_advanced_email_form.py @@ -1,6 +1,6 @@ from django.utils.translation import gettext_lazy as _ -from wagtail.admin.edit_handlers import MultiFieldPanel, FieldRowPanel, FieldPanel +from wagtail.admin.panels import MultiFieldPanel, FieldRowPanel, FieldPanel from wagtail.contrib.forms.models import AbstractEmailForm from .abstract_advanced_form_mixin import AbstractAdvancedFormMixin diff --git a/wagtail_advanced_form_builder/models/abstract_advanced_form_field.py b/wagtail_advanced_form_builder/models/abstract_advanced_form_field.py index fafda6b..8f1f56a 100644 --- a/wagtail_advanced_form_builder/models/abstract_advanced_form_field.py +++ b/wagtail_advanced_form_builder/models/abstract_advanced_form_field.py @@ -2,53 +2,51 @@ from django.utils.translation import gettext_lazy as _ from modelcluster.models import ClusterableModel - from wagtail.contrib.forms.models import AbstractFormField -from wagtail.core.fields import RichTextField +from wagtail.fields import RichTextField import wagtail_advanced_form_builder.constants as consts + from wagtail_advanced_form_builder.utils import clean_form_field_name OVERRIDE_FORM_FIELD_CHOICES = ( - (consts.FIELD_TYPE_SINGLE_LINE, _('Single line text')), - (consts.FIELD_TYPE_MULTI_LINE, _('Multi-line text')), - (consts.FIELD_TYPE_EMAIL, _('Email')), - (consts.FIELD_TYPE_NUMBER, _('Number')), - (consts.FIELD_TYPE_URL, _('URL')), - (consts.FIELD_TYPE_CHECKBOX, _('Checkbox')), - (consts.FIELD_TYPE_CHECKBOXES, _('Checkboxes')), - (consts.FIELD_TYPE_DROPDOWN, _('Drop down')), - (consts.FIELD_TYPE_MULTI_SELECT, _('Multiple select')), - (consts.FIELD_TYPE_RADIO, _('Radio buttons')), - (consts.FIELD_TYPE_DATE, _('Date')), - (consts.FIELD_TYPE_HIDDEN, _('Hidden field')), - (consts.FIELD_TYPE_CURRENCY, _('Currency field')), - (consts.FIELD_TYPE_SIMPLE_DATE, _('Date')), - (consts.FIELD_TYPE_PHONE, _('Phone')), + (consts.FIELD_TYPE_SINGLE_LINE, _("Single line text")), + (consts.FIELD_TYPE_MULTI_LINE, _("Multi-line text")), + (consts.FIELD_TYPE_EMAIL, _("Email")), + (consts.FIELD_TYPE_NUMBER, _("Number")), + (consts.FIELD_TYPE_URL, _("URL")), + (consts.FIELD_TYPE_CHECKBOX, _("Checkbox")), + (consts.FIELD_TYPE_CHECKBOXES, _("Checkboxes")), + (consts.FIELD_TYPE_DROPDOWN, _("Drop down")), + (consts.FIELD_TYPE_MULTI_SELECT, _("Multiple select")), + (consts.FIELD_TYPE_RADIO, _("Radio buttons")), + (consts.FIELD_TYPE_DATE, _("Date")), + (consts.FIELD_TYPE_HIDDEN, _("Hidden field")), + (consts.FIELD_TYPE_CURRENCY, _("Currency field")), + (consts.FIELD_TYPE_SIMPLE_DATE, _("Date")), + (consts.FIELD_TYPE_PHONE, _("Phone")), ) class AbstractAdvancedFormField(AbstractFormField, ClusterableModel): - # extend the built in field type choices so we can add custom fields CHOICES = OVERRIDE_FORM_FIELD_CHOICES # override the field_type field with extended choices field_type = models.CharField( - verbose_name='field type', + verbose_name="field type", max_length=16, # use the choices tuple defined above - choices=CHOICES + choices=CHOICES, ) rule_action = models.CharField( choices=consts.FIELD_ACTION_CHOICES, blank=True, - default='', + default="", max_length=10, ) - # Storage for HTML field only html_value = RichTextField( default=None, @@ -63,6 +61,13 @@ class AbstractAdvancedFormField(AbstractFormField, ClusterableModel): blank=True, ) + # Set a minimum length on fields + min_length = models.IntegerField( + default=None, + null=True, + blank=True, + ) + # Empty label option for choice fields only empty_label = models.CharField( max_length=255, @@ -72,17 +77,17 @@ class AbstractAdvancedFormField(AbstractFormField, ClusterableModel): ) # Storage for checkboxes and radios only - display_side_by_side = models.BooleanField( - default=False - ) + display_side_by_side = models.BooleanField(default=False) display_checkbox_label = models.BooleanField( default=False, ) + name = models.CharField(max_length=255, blank=True) + toggled_label = models.CharField(max_length=255, blank=True) @property def clean_name(self): - return clean_form_field_name(self.label) + return self.name or clean_form_field_name(self.label) class Meta: abstract = True diff --git a/wagtail_advanced_form_builder/models/abstract_advanced_form_mixin.py b/wagtail_advanced_form_builder/models/abstract_advanced_form_mixin.py index 3ea3ad1..9b51fae 100644 --- a/wagtail_advanced_form_builder/models/abstract_advanced_form_mixin.py +++ b/wagtail_advanced_form_builder/models/abstract_advanced_form_mixin.py @@ -5,16 +5,16 @@ from django.shortcuts import render from django.utils.translation import gettext_lazy as _ -from wagtail.admin.edit_handlers import StreamFieldPanel, FieldPanel, MultiFieldPanel -from wagtail.core.fields import RichTextField, StreamField -from wagtail.core.rich_text import RichText +from wagtail.admin.panels import FieldPanel, MultiFieldPanel +from wagtail.fields import RichTextField, StreamField +from wagtail.rich_text import RichText + +import wagtail_advanced_form_builder.constants as consts from wagtail_advanced_form_builder.blocks.fields import SingleLineFieldBlock from wagtail_advanced_form_builder.forms import AdvancedFormBuilder -from .form_field import FormField - -import wagtail_advanced_form_builder.constants as consts from wagtail_advanced_form_builder.utils import clean_form_field_name + from ..blocks.fields.checkbox_field_block import CheckboxFieldBlock from ..blocks.fields.checkboxes_field_block import CheckboxesFieldBlock from ..blocks.fields.dropdown_field_block import DropdownFieldBlock @@ -26,26 +26,26 @@ from ..blocks.fields.number_field_block import NumberFieldBlock from ..blocks.fields.radio_field_block import RadioFieldBlock from ..blocks.fields.url_field_block import URLFieldBlock +from .form_field import FormField def parse_condition_value(value): - if value is False or value is None: - return '' + return "" if value is True: - return 'on' + return "on" if isinstance(value, list): if len(value) == 0: - return '' + return "" else: - return ','.join(value) + return ",".join(value) return value -def conditions_passed(condition_rule, condition_value, condition_field_value): +def conditions_passed(condition_rule, condition_value, condition_field_value): condition_field_value = parse_condition_value(condition_field_value) if condition_rule == consts.FIELD_RULE_IS: @@ -57,11 +57,11 @@ def conditions_passed(condition_rule, condition_value, condition_field_value): return False if condition_rule == consts.FIELD_RULE_IS_BLANK: - if condition_field_value != '': + if condition_field_value != "": return False if condition_rule == consts.FIELD_RULE_IS_NOT_BLANK: - if condition_field_value == '': + if condition_field_value == "": return False if condition_rule == consts.FIELD_RULE_GREATER_THAN: @@ -105,11 +105,11 @@ def conditions_passed(condition_rule, condition_value, condition_field_value): return False if condition_rule == consts.FIELD_RULE_STARTS_WITH: - if not condition_field_value.startsWith(condition_value): + if not condition_field_value.startswith(condition_value): return False if condition_rule == consts.FIELD_RULE_ENDS_WITH: - if not condition_field_value.endsWith(condition_value): + if not condition_field_value.endswith(condition_value): return False return True @@ -124,36 +124,36 @@ def clean_form(self): """ for condition in self.conditional_rules: - all_conditions_passed = True # Only check if the field is required - field_required = condition['required'] + field_required = condition["required"] if field_required: - action = condition['action'] + action = condition["action"] - for cond in condition['conditions']: - condition_rule = cond['rule'] - condition_value = cond['value'] - condition_field_value = self.cleaned_data.get(cond['field_name'], None) + for cond in condition["conditions"]: + condition_rule = cond["rule"] + condition_value = cond["value"] + condition_field_value = self.cleaned_data.get(cond["field_name"], None) - all_conditions_passed = conditions_passed(condition_rule, condition_value, condition_field_value) + all_conditions_passed = conditions_passed( + condition_rule, condition_value, condition_field_value + ) if not all_conditions_passed: break if not all_conditions_passed and action == consts.FIELD_ACTION_SHOW: - if condition['field_name'] in self._errors: - del self._errors[condition['field_name']] + if condition["field_name"] in self._errors: + del self._errors[condition["field_name"]] elif all_conditions_passed and action == consts.FIELD_ACTION_HIDE: - if condition['field_name'] in self._errors: - del self._errors[condition['field_name']] + if condition["field_name"] in self._errors: + del self._errors[condition["field_name"]] return self.cleaned_data class AbstractAdvancedFormMixin(models.Model): - - landing_page_template = 'wagtail_advanced_form_builder/page/form_complete.html' + landing_page_template = "wagtail_advanced_form_builder/page/form_complete.html" form_builder = AdvancedFormBuilder @@ -161,23 +161,33 @@ class AbstractAdvancedFormMixin(models.Model): form = StreamField( [ - (consts.FIELD_TYPE_SINGLE_LINE, SingleLineFieldBlock(label=_('Basic field'))), - (consts.FIELD_TYPE_EMAIL, EmailFieldBlock(label=_('Email field'))), - (consts.FIELD_TYPE_HTML, HTMLFieldBlock(label=_('HTML'))), - (consts.FIELD_TYPE_DROPDOWN, DropdownFieldBlock(label=_('Dropdown field'))), - (consts.FIELD_TYPE_RADIO, RadioFieldBlock(label=_('Radio field'))), - (consts.FIELD_TYPE_CHECKBOXES, CheckboxesFieldBlock(label=_('Checkboxes field'))), - (consts.FIELD_TYPE_CHECKBOX, CheckboxFieldBlock(label=_('Checkbox field'))), - (consts.FIELD_TYPE_MULTI_SELECT, MultiSelectFieldBlock(label=_('Multiselect field'))), - (consts.FIELD_TYPE_MULTI_LINE, MultiLineFieldBlock(label=_('Multiline field'))), - (consts.FIELD_TYPE_URL, URLFieldBlock(label=_('URL field'))), - (consts.FIELD_TYPE_HIDDEN, HiddenFieldBlock(label=_('Hidden field'))), - (consts.FIELD_TYPE_NUMBER, NumberFieldBlock(label=_('Number field'))), + (consts.FIELD_TYPE_SINGLE_LINE, SingleLineFieldBlock(label=_("Basic field"))), + (consts.FIELD_TYPE_EMAIL, EmailFieldBlock(label=_("Email field"))), + (consts.FIELD_TYPE_HTML, HTMLFieldBlock(label=_("HTML"))), + (consts.FIELD_TYPE_DROPDOWN, DropdownFieldBlock(label=_("Dropdown field"))), + (consts.FIELD_TYPE_RADIO, RadioFieldBlock(label=_("Radio field"))), + ( + consts.FIELD_TYPE_CHECKBOXES, + CheckboxesFieldBlock(label=_("Checkboxes field")), + ), + (consts.FIELD_TYPE_CHECKBOX, CheckboxFieldBlock(label=_("Checkbox field"))), + ( + consts.FIELD_TYPE_MULTI_SELECT, + MultiSelectFieldBlock(label=_("Multiselect field")), + ), + ( + consts.FIELD_TYPE_MULTI_LINE, + MultiLineFieldBlock(label=_("Multiline field")), + ), + (consts.FIELD_TYPE_URL, URLFieldBlock(label=_("URL field"))), + (consts.FIELD_TYPE_HIDDEN, HiddenFieldBlock(label=_("Hidden field"))), + (consts.FIELD_TYPE_NUMBER, NumberFieldBlock(label=_("Number field"))), ], default=None, null=True, blank=False, - help_text=_('Add fields to the form') + help_text=_("Add fields to the form"), + use_json_field=True, ) thanks_page_title = models.CharField( @@ -185,47 +195,49 @@ class AbstractAdvancedFormMixin(models.Model): default=None, null=True, blank=True, - help_text=_('The title for the thanks page. Defaults to the normal page title if left blank.') + help_text=_( + "The title for the thanks page. Defaults to the normal page title if left blank." + ), ) thanks_page_content = RichTextField( default=None, null=True, blank=False, - help_text=_('Content to display on the form thank you page.') + help_text=_("Content to display on the form thank you page."), ) submit_button_text = models.CharField( max_length=30, - default=_('Submit'), - help_text=_('The text to display on the form submission button'), + default=_("Submit"), + help_text=_("The text to display on the form submission button"), blank=False, ) use_browser_validation = models.BooleanField( blank=True, default=False, - help_text=_('Tick this to use the in-built browser validation on fields') + help_text=_("Tick this to use the in-built browser validation on fields"), ) content_panels = [ - StreamFieldPanel('form'), - FieldPanel('submit_button_text'), + FieldPanel("form"), + FieldPanel("submit_button_text"), MultiFieldPanel( [ - FieldPanel('thanks_page_title'), - FieldPanel('thanks_page_content'), + FieldPanel("thanks_page_title"), + FieldPanel("thanks_page_content"), ], - heading='Thanks page' + heading="Thanks page", ), ] settings_panels = [ - FieldPanel('use_browser_validation'), + FieldPanel("use_browser_validation"), ] def get_template(self, request, *args, **kwargs): - return 'wagtail_advanced_form_builder/page/form.html' + return "wagtail_advanced_form_builder/page/form.html" def get_conditional_rules(self): """ @@ -236,31 +248,31 @@ def get_conditional_rules(self): conditional_rules = [] for field in self.form.get_prep_value(): - - rules = field['value'].get('rules', None) + rules = field["value"].get("rules", None) if rules: - field_id = field['value'].get('field_id', None) + field_id = field["value"].get("field_id", None) if field_id: - rules['field_name'] = field_id + rules["field_name"] = field_id else: - rules['field_name'] = clean_form_field_name(field['value']['label']) - rules['required'] = field['value'].get('required', False) - rules['field_type'] = field.get('type', None) - conditions = rules.get('conditions', None) + rules["field_name"] = clean_form_field_name(field["value"]["label"]) + rules["required"] = field["value"].get("required", False) + rules["field_type"] = field.get("type", None) + conditions = rules.get("conditions", None) if len(conditions): for condition in conditions: - del(condition['id']) - del(condition['type']) - condition['field_name'] = clean_form_field_name(condition['value']['field_name']) - condition['rule'] = condition['value']['rule'] - condition['value'] = condition['value'].get('value', None) + del condition["id"] + del condition["type"] + condition["field_name"] = clean_form_field_name( + condition["value"]["field_name"] + ) + condition["rule"] = condition["value"]["rule"] + condition["value"] = condition["value"].get("value", None) conditional_rules.append(rules) return conditional_rules def get_form(self, *args, **kwargs): - """ Overriden get_form method to allow for a custom validator on the form :param args: @@ -284,7 +296,7 @@ def get_data_fields(self): Returns a list of tuples with (field_name, field_label). """ data_fields = [ - ('submit_time', _('Submission date')), + ("submit_time", _("Submission date")), ] data_fields += [ (field.clean_name, field.label) @@ -302,36 +314,50 @@ def get_form_fields(self, exclude_html=False): """ fields = [] for field in self.form.get_prep_value(): - - field_type = field['type'] + field_type = field["type"] if exclude_html and field_type == consts.FIELD_TYPE_HTML: continue - html_value = field['value'].get('html', None) + html_value = field["value"].get("html", None) if html_value: html_value = RichText(html_value) - rule_action = '' - rules = field['value'].get('rules', None) + rule_action = "" + rules = field["value"].get("rules", None) if rules: - conditions = rules.get('conditions', None) + conditions = rules.get("conditions", None) if len(conditions): - rule_action = rules.get('action') - - form_field = self.form_field( - field_type=field['type'], - label=field['value']['label'], - required=field['value'].get('required', False), - choices=field['value'].get('choices', None), - help_text=field['value'].get('help_text', None), - default_value=field['value'].get('default_value', None), - empty_label=field['value'].get('empty_label', None), - max_length=field['value'].get('max_length', None), - display_side_by_side=field['value'].get('display_side_by_side', False), - display_checkbox_label=field['value'].get('display_checkbox_label', False), - html_value=html_value, - rule_action=rule_action, - ) + rule_action = rules.get("action") + + if field["type"] == "form_snippet": + form_field = self.form_field( + field_type=field["type"], + label="Form Snippet", + rule_action=rule_action, + page_id=field["value"]["form"], + ) + else: + form_field = self.form_field( + field_type=field["type"], + label=field["value"]["label"], + required=field["value"].get("required", False), + choices=field["value"].get("choices", None), + help_text=field["value"].get("help_text", None), + default_value=field["value"].get("default_value", None), + empty_label=field["value"].get("empty_label", None), + max_length=field["value"].get("max_length", None), + min_length=field["value"].get("min_length", None), + display_side_by_side=field["value"].get( + "display_side_by_side", False + ), + display_checkbox_label=field["value"].get( + "display_checkbox_label", False + ), + html_value=html_value, + rule_action=rule_action, + name=field["value"].get("name", None), + toggled_label=field["value"].get("toggled_label", None), + ) fields.append(form_field) @@ -349,17 +375,15 @@ def serve(self, request, *args, **kwargs): template = self.get_template(request) - if request.method == 'POST': - + if request.method == "POST": form = self.get_form(request.POST, page=self, user=request.user) if form.is_valid(): self.process_form_submission(form) - return HttpResponseRedirect(self.url + '?thank=you') + return HttpResponseRedirect(self.url + "?thank=you") else: - - thanks = request.GET.get('thank', False) + thanks = request.GET.get("thank", False) if thanks: form = None template = self.get_landing_page_template(request) @@ -369,15 +393,11 @@ def serve(self, request, *args, **kwargs): form = self.get_form(page=self, user=request.user) context = self.get_context(request) - context['form'] = form + context["form"] = form if form: - context['conditional_rules'] = json.dumps(form.conditional_rules) + context["conditional_rules"] = json.dumps(form.conditional_rules) - return render( - request, - template, - context - ) + return render(request, template, context) class Meta: abstract = True diff --git a/wagtail_advanced_form_builder/models/email_form_page.py b/wagtail_advanced_form_builder/models/email_form_page.py index c2fd137..4691337 100644 --- a/wagtail_advanced_form_builder/models/email_form_page.py +++ b/wagtail_advanced_form_builder/models/email_form_page.py @@ -1,4 +1,4 @@ -from wagtail.core.models import Page +from wagtail.models import Page from .abstract_advanced_email_form import AbstractAdvancedEmailForm diff --git a/wagtail_advanced_form_builder/models/form_page.py b/wagtail_advanced_form_builder/models/form_page.py index 2110ffa..34fc13b 100644 --- a/wagtail_advanced_form_builder/models/form_page.py +++ b/wagtail_advanced_form_builder/models/form_page.py @@ -1,4 +1,4 @@ -from wagtail.core.models import Page +from wagtail.models import Page from wagtail_advanced_form_builder.models.abstract_advanced_form import AbstractAdvancedForm diff --git a/wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/js/admin.js b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/admin.js similarity index 100% rename from wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/js/admin.js rename to wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/admin.js diff --git a/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/field-toggle-widget.js b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/field-toggle-widget.js new file mode 100644 index 0000000..e0739a3 --- /dev/null +++ b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/field-toggle-widget.js @@ -0,0 +1,27 @@ + +(function () { + class FieldToggle { + constructor (container) { + this.container = container; + this.input = container.querySelector('input'); + this.label = container.querySelector('label'); + this.labelText = this.input.dataset.label; + this.toggledLabelText = this.input.dataset.toggledLabel; + console.log({ input: this.input, label: this.label }); + + this.input.addEventListener('change', this.toggle.bind(this)); + } + + toggle () { + if (this.input.checked) { + this.label.innerText = this.toggledLabelText; + } else { + this.label.innerText = this.labelText; + } + } + } + + document.querySelectorAll('.waf--field-toggle').forEach(function (fieldToggleContainer) { + new FieldToggle(fieldToggleContainer); + }); +})(); \ No newline at end of file diff --git a/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/formbuilder.js b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/formbuilder.js new file mode 100644 index 0000000..dc92e48 --- /dev/null +++ b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/js/formbuilder.js @@ -0,0 +1,286 @@ +(function () { + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.msMatchesSelector || + Element.prototype.webkitMatchesSelector; + } + + if (!Element.prototype.closest) { + Element.prototype.closest = function(s) { + var el = this; + + do { + if (Element.prototype.matches.call(el, s)) return el; + el = el.parentElement || el.parentNode; + } while (el !== null && el.nodeType === 1); + return null; + }; + } + + function findFieldsFromName(name, returnOneOnly = false) { + const fields = document.getElementsByName(name); + if (fields.length) { + return returnOneOnly ? fields[0] : fields; + } + return null; + } + + function findFieldParentContainer(element) { + if (element) { + const parent = element.closest('[data-waf-field]'); + if (parent) { + return parent; + } + } + return null; + } + + function isMultipleFields(field) { + return typeof field.length !== 'undefined' && typeof field.item !== 'undefined' && field.length > 1; + } + + function isCheckboxOrRadio(field) { + const fieldType = field.getAttribute('type'); + return fieldType === 'checkbox' || fieldType === 'radio'; + } + + function isMultiSelectField(field) { + return field.hasAttribute('multiple'); + } + + function getValueFromAllSelectedOptions(field) { + const options = field && field.options; + let value = ''; + for (let i = 0; i < options.length; i++) { + const option = options[i]; + if (option.selected) { + value += option.value + ','; + } + } + value = value.replace(/[,/]\s*$/, ''); + return value; + } + + function getFieldValue(field) { + if (isMultipleFields(field)) { + let fieldValue = ''; + field.forEach((f) => { + if (isCheckboxOrRadio(f)) { + if (f.checked) { + fieldValue += `${ f.value.trim() },`; + } + } + }); + + // cleanup the field value + fieldValue = fieldValue.replace(/[,/]\s*$/, ''); + return fieldValue; + } + field = field[0]; + if (isCheckboxOrRadio(field)) { + if (field.checked) { + return 'on'; + } + return ''; + } + + if (isMultiSelectField(field)) { + return getValueFromAllSelectedOptions(field); + } + // We're dealing with a standard string field here so trim it up and send it off + return field.value.trim(); + } + + function toggleField(field, showHide) { + if (field) { + if (showHide === 'show') { + field.style.display = 'block'; + } else { + field.style.display = 'none'; + } + } + } + + function conditionsPassed(conditionRule, conditionValue, conditionField) { + let conditionFieldValue = null; + let parsedValue = null; + + switch (conditionRule) { + case 'is': + if (conditionField.value !== conditionValue) { + return false; + } + break; + case 'is_not': + if (conditionField.value === conditionValue) { + return false; + } + break; + case 'is_blank': + if (conditionField.value !== '') { + return false; + } + break; + case 'is_not_blank': + if (conditionField.value === '') { + return false; + } + break; + case 'greater_than': + conditionFieldValue = parseFloat(conditionField.value); + parsedValue = parseFloat(conditionValue); + // eslint-disable-next-line no-restricted-globals + if (isNaN(conditionFieldValue) || conditionFieldValue <= parsedValue) { + return false; + } + break; + case 'greater_than_equal': + conditionFieldValue = parseFloat(conditionField.value); + parsedValue = parseFloat(conditionValue); + // eslint-disable-next-line no-restricted-globals + if (isNaN(conditionFieldValue) || conditionFieldValue < parsedValue) { + return false; + } + break; + case 'less_than': + conditionFieldValue = parseFloat(conditionField.value); + parsedValue = parseFloat(conditionValue); + // eslint-disable-next-line no-restricted-globals + if (isNaN(conditionFieldValue) || conditionFieldValue >= parsedValue) { + return false; + } + break; + case 'less_than_equal': + conditionFieldValue = parseFloat(conditionField.value); + parsedValue = parseFloat(conditionValue); + // eslint-disable-next-line no-restricted-globals + if (isNaN(conditionFieldValue) || conditionFieldValue > parsedValue) { + return false; + } + break; + case 'contains': + if (!conditionField.value.includes(conditionValue)) { + return false; + } + break; + case 'starts-with': + if (!conditionField.value.startsWith(conditionValue)) { + return false; + } + break; + case 'ends-with': + if (!conditionField.value.endsWith(conditionValue)) { + return false; + } + break; + default: + break; + } + return true; + } + + function checkConditions() { + window.wafFormConditions.forEach((condition) => { + + // Default pass on conditions + let allConditionsPassed = true; + + // Grab the action field details + const actionField = {}; + actionField.action = condition.action; + actionField.type = condition.field_type; + actionField.field = findFieldsFromName(condition.field_name, true); + actionField.parent = findFieldParentContainer(actionField.field); + actionField.required = actionField.type === 'checkboxes' ? false : condition.required; + + // Cycle through the conditions associated with the action field + for (let i = 0; i < condition.conditions.length; i++) { + const cond = condition.conditions[i]; + const conditionRule = cond.rule; + const conditionValue = cond.value; + + const conditionField = {}; + conditionField.field = findFieldsFromName(cond.field_name); + conditionField.value = getFieldValue(conditionField.field); + + // Check whether the conditions have passed for this field. + allConditionsPassed = conditionsPassed(conditionRule, conditionValue, conditionField); + + // Any conditions not passed then break out of the loop. + if (!allConditionsPassed) { + break; + } + } + + if (allConditionsPassed) { + if (actionField.action === 'show') { + toggleField(actionField.parent, 'show'); + if (actionField.required) { + actionField.field.required = true; + } + } else { + toggleField(actionField.parent, 'hide'); + actionField.field.required = false + } + } else if (actionField.action === 'show') { + toggleField(actionField.parent, 'hide'); + actionField.field.required = false; + } else { + toggleField(actionField.parent, 'show'); + if (actionField.required) { + actionField.field.required = true; + } + } + }); + } + + function initialiseFormListeners(form) { + // Assign event listeners to fields of this type + const tags = ['input', 'select', 'textarea']; + tags.forEach((tag) => { + const tagEls = form.getElementsByTagName(tag); + if (tagEls.length) { + for (let i = 0; i < tagEls.length; i++) { + tagEls[i].addEventListener('keyup', () => { + checkConditions(); + }); + tagEls[i].addEventListener('change', () => { + checkConditions(); + }); + } + } + }); + } + + function scrollToError() { + const errors = document.getElementsByClassName('waf--field-container--error'); + if (errors.length) { + errors[0].scrollIntoView(); + } + } + + function initForm (form) { + if (window.wafFormConditions) { + // Initialise the form listeners + initialiseFormListeners(form); + // Check the conditions on page load + checkConditions(); + // All conditions checked, so display the form. + form.style.display = 'block'; + // Check for errors to scroll to + scrollToError(); + } + } + + function init() { + // Grab the form + const form = document.getElementById('waf--form-page-form'); + initForm(form) + } + + init(); + + window.waf = { + initForm + } +})() diff --git a/wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/scss/main.scss b/wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/scss/main.scss similarity index 100% rename from wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/scss/main.scss rename to wagtail_advanced_form_builder/static/wagtail_advanced_form_builder/scss/main.scss diff --git a/wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/js/formbuilder.js b/wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/js/formbuilder.js deleted file mode 100644 index b41aa97..0000000 --- a/wagtail_advanced_form_builder/static_src/wagtail_advanced_form_builder/js/formbuilder.js +++ /dev/null @@ -1,280 +0,0 @@ -if (!Element.prototype.matches) { - Element.prototype.matches = - Element.prototype.msMatchesSelector || - Element.prototype.webkitMatchesSelector; -} - -if (!Element.prototype.closest) { - Element.prototype.closest = function(s) { - var el = this; - - do { - if (Element.prototype.matches.call(el, s)) return el; - el = el.parentElement || el.parentNode; - } while (el !== null && el.nodeType === 1); - return null; - }; -} - -function findFieldsFromName(name, returnOneOnly = false) { - const fields = document.getElementsByName(name); - if (fields.length) { - return returnOneOnly ? fields[0] : fields; - } - return null; -} - -function findFieldParentContainer(element) { - if (element) { - const parent = element.closest('[data-waf-field]'); - if (parent) { - return parent; - } - } - return null; -} - -function isMultipleFields(field) { - return typeof field.length !== 'undefined' && typeof field.item !== 'undefined' && field.length > 1; -} - -function isCheckboxOrRadio(field) { - const fieldType = field.getAttribute('type'); - return fieldType === 'checkbox' || fieldType === 'radio'; -} - -function isMultiSelectField(field) { - return field.hasAttribute('multiple'); -} - -function getValueFromAllSelectedOptions(field) { - const options = field && field.options; - let value = ''; - for (let i = 0; i < options.length; i++) { - const option = options[i]; - if (option.selected) { - value += option.value + ','; - } - } - value = value.replace(/[,/]\s*$/, ''); - return value; -} - -function getFieldValue(field) { - if (isMultipleFields(field)) { - let fieldValue = ''; - field.forEach((f) => { - if (isCheckboxOrRadio(f)) { - if (f.checked) { - fieldValue += `${ f.value.trim() },`; - } - } - }); - - // cleanup the field value - fieldValue = fieldValue.replace(/[,/]\s*$/, ''); - return fieldValue; - } - field = field[0]; - if (isCheckboxOrRadio(field)) { - if (field.checked) { - return 'on'; - } - return ''; - } - - if (isMultiSelectField(field)) { - return getValueFromAllSelectedOptions(field); - } - // We're dealing with a standard string field here so trim it up and send it off - return field.value.trim(); -} - -function toggleField(field, showHide) { - if (field) { - if (showHide === 'show') { - field.style.display = 'block'; - } else { - field.style.display = 'none'; - } - } -} - -function conditionsPassed(conditionRule, conditionValue, conditionField) { - let conditionFieldValue = null; - let parsedValue = null; - - switch (conditionRule) { - case 'is': - if (conditionField.value !== conditionValue) { - return false; - } - break; - case 'is_not': - if (conditionField.value === conditionValue) { - return false; - } - break; - case 'is_blank': - if (conditionField.value !== '') { - return false; - } - break; - case 'is_not_blank': - if (conditionField.value === '') { - return false; - } - break; - case 'greater_than': - conditionFieldValue = parseFloat(conditionField.value); - parsedValue = parseFloat(conditionValue); - // eslint-disable-next-line no-restricted-globals - if (isNaN(conditionFieldValue) || conditionFieldValue <= parsedValue) { - return false; - } - break; - case 'greater_than_equal': - conditionFieldValue = parseFloat(conditionField.value); - parsedValue = parseFloat(conditionValue); - // eslint-disable-next-line no-restricted-globals - if (isNaN(conditionFieldValue) || conditionFieldValue < parsedValue) { - return false; - } - break; - case 'less_than': - conditionFieldValue = parseFloat(conditionField.value); - parsedValue = parseFloat(conditionValue); - // eslint-disable-next-line no-restricted-globals - if (isNaN(conditionFieldValue) || conditionFieldValue >= parsedValue) { - return false; - } - break; - case 'less_than_equal': - conditionFieldValue = parseFloat(conditionField.value); - parsedValue = parseFloat(conditionValue); - // eslint-disable-next-line no-restricted-globals - if (isNaN(conditionFieldValue) || conditionFieldValue > parsedValue) { - return false; - } - break; - case 'contains': - if (!conditionField.value.includes(conditionValue)) { - return false; - } - break; - case 'starts-with': - if (!conditionField.value.startsWith(conditionValue)) { - return false; - } - break; - case 'ends-with': - if (!conditionField.value.endsWith(conditionValue)) { - return false; - } - break; - default: - break; - } - return true; -} - -function checkConditions() { - window.wafFormConditions.forEach((condition) => { - - // Default pass on conditions - let allConditionsPassed = true; - - // Grab the action field details - const actionField = {}; - actionField.action = condition.action; - actionField.type = condition.field_type; - actionField.field = findFieldsFromName(condition.field_name, true); - actionField.parent = findFieldParentContainer(actionField.field); - actionField.required = actionField.type === 'checkboxes' ? false : condition.required; - - // Cycle through the conditions associated with the action field - for (let i = 0; i < condition.conditions.length; i++) { - const cond = condition.conditions[i]; - const conditionRule = cond.rule; - const conditionValue = cond.value; - - const conditionField = {}; - conditionField.field = findFieldsFromName(cond.field_name); - conditionField.value = getFieldValue(conditionField.field); - - // Check whether the conditions have passed for this field. - allConditionsPassed = conditionsPassed(conditionRule, conditionValue, conditionField); - - // Any conditions not passed then break out of the loop. - if (!allConditionsPassed) { - break; - } - } - - if (allConditionsPassed) { - if (actionField.action === 'show') { - toggleField(actionField.parent, 'show'); - if (actionField.required) { - actionField.field.required = true; - } - } else { - toggleField(actionField.parent, 'hide'); - actionField.field.required = false - } - } else if (actionField.action === 'show') { - toggleField(actionField.parent, 'hide'); - actionField.field.required = false; - } else { - toggleField(actionField.parent, 'show'); - if (actionField.required) { - actionField.field.required = true; - } - } - }); -} - -function initialiseFormListeners(form) { - // Assign event listeners to fields of this type - const tags = ['input', 'select', 'textarea']; - tags.forEach((tag) => { - const tagEls = form.getElementsByTagName(tag); - if (tagEls.length) { - for (let i = 0; i < tagEls.length; i++) { - tagEls[i].addEventListener('keyup', () => { - checkConditions(); - }); - tagEls[i].addEventListener('change', () => { - checkConditions(); - }); - } - } - }); -} - -function scrollToError() { - const errors = document.getElementsByClassName('waf--field-container--error'); - if (errors.length) { - errors[0].scrollIntoView(); - } -} - -function init() { - if (window.wafFormConditions) { - // Grab the form - const form = document.getElementById('waf--form-page-form'); - - // Initialise the form listeners - initialiseFormListeners(form); - - // Check the conditions on page load - checkConditions(); - - // All conditions checked, so display the form. - form.style.display = 'block'; - - // Check for errors to scroll to - scrollToError(); - } -} - -init(); diff --git a/wagtail_advanced_form_builder/templates/wagtail_advanced_form_builder/fields/checkbox_field.html b/wagtail_advanced_form_builder/templates/wagtail_advanced_form_builder/fields/checkbox_field.html index ed46a38..c527aec 100644 --- a/wagtail_advanced_form_builder/templates/wagtail_advanced_form_builder/fields/checkbox_field.html +++ b/wagtail_advanced_form_builder/templates/wagtail_advanced_form_builder/fields/checkbox_field.html @@ -2,18 +2,16 @@ class="waf--field-container {% if field.errors %}waf--field-container--error{% endif %}" data-waf-field > -