diff --git a/app/main/forms.py b/app/main/forms.py index 46592daf9..70c7b7457 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1372,7 +1372,6 @@ def get_placeholder_form_instance( placeholder_name, dict_to_populate_from, template_type, - optional_placeholder=False, allow_international_phone_numbers=False, ): @@ -1389,8 +1388,6 @@ def get_placeholder_form_instance( field = international_phone_number(label=placeholder_name) else: field = uk_mobile_number(label=placeholder_name) - elif optional_placeholder: - field = StringField(placeholder_name) else: field = StringField(placeholder_name, validators=[ DataRequired(message='Cannot be empty') diff --git a/app/main/views/send.py b/app/main/views/send.py index 946900f8f..acea53a57 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -399,7 +399,6 @@ def send_one_off_letter_address(service_id, template_id): ), template=template, form=form, - optional_placeholder=False, back_link=get_back_link(service_id, template, 0), help=False, link_to_upload=True, @@ -478,12 +477,10 @@ def send_test_step(service_id, template_id, step_index): ): return redirect(url_for('.send_one_off_letter_address', service_id=service_id, template_id=template_id)) - optional_placeholder = (current_placeholder in optional_address_columns) form = get_placeholder_form_instance( current_placeholder, dict_to_populate_from=get_normalised_placeholders_from_session(), template_type=template.template_type, - optional_placeholder=optional_placeholder, allow_international_phone_numbers=current_service.has_permission('international_sms'), ) @@ -540,7 +537,6 @@ def send_test_step(service_id, template_id, step_index): template=template, form=form, skip_link=skip_link, - optional_placeholder=optional_placeholder, back_link=back_link, help=get_help_argument(), link_to_upload=( diff --git a/app/templates/views/send-test.html b/app/templates/views/send-test.html index ad3915678..e6db812db 100644 --- a/app/templates/views/send-test.html +++ b/app/templates/views/send-test.html @@ -25,7 +25,6 @@
{{ textbox( form.placeholder_value, - hint='Optional' if optional_placeholder else None, width='1-1', ) }}
diff --git a/tests/app/main/test_placeholder_form.py b/tests/app/main/test_placeholder_form.py index 9771c98a5..d737c0d59 100644 --- a/tests/app/main/test_placeholder_form.py +++ b/tests/app/main/test_placeholder_form.py @@ -9,11 +9,11 @@ def test_form_class_not_mutated(app_): method='POST', data={'placeholder_value': ''} ): - form1 = get_placeholder_form_instance('name', {}, 'sms', optional_placeholder=False) - form2 = get_placeholder_form_instance('city', {}, 'sms', optional_placeholder=True) + form1 = get_placeholder_form_instance('name', {}, 'sms') + form2 = get_placeholder_form_instance('city', {}, 'sms') assert not form1.validate_on_submit() - assert form2.validate_on_submit() + assert not form2.validate_on_submit() assert str(form1.placeholder_value.label) == '' assert str(form2.placeholder_value.label) == ''