Hi I ve added the below to my contact form
Does anyone know how to make it a required field ??
the rest of my fields are like this
Hi I ve added the below to my contact form
Does anyone know how to make it a required field ??
the rest of my fields are like this
Hi thanks, that doesnt seem to work , ive tried adding that ‘required’ it srtill send without me slecting a drop down ?
I am sorry for that. Can you confirm your button is “submit” and not a regular “button” ? It should look like :
You can share the contact form URL here if you can
Thanks
Hi here is the page code..
button is
{{ ‘contact.form.submit’ | t }}
{%- endform -%}
page code ..
{%- if form.posted_successfully? -%}
{{ 'contact.form.successfully_sent' | t }}
{%- endif -%}{%- if form.errors -%}
{%- for block in section.blocks -%}
{%- assign field_title = block.settings.title -%}
{%- if field_title == blank -%}
{%- capture field_title -%}Custom field {% increment custom_field %}{%- endcapture -%}
{%- endif -%}
{%- if block.type == ‘text’ -%}
{%- if values == empty -%}
{%- continue -%}
{%- endif -%}
{{ block.settings.title | escape }}
{{ ‘contact.form.submit’ | t }}
{%- endform -%}
{%- if section.settings.show_store_info -%}
{%- if section.settings.store_image -%}
{%- if section.settings.store_info != blank -%}
{% schema %}
{
“name”: “Contact form”,
“settings”: [
{
“type”: “header”,
“content”: “Form”
},
{
“type”: “text”,
“id”: “form_heading”,
“label”: “Heading”
},
{
“type”: “header”,
“content”: “Store info”
},
{
“type”: “checkbox”,
“id”: “show_store_info”,
“label”: “Show store info”,
“default”: false
},
{
“type”: “text”,
“id”: “store_heading”,
“label”: “Heading”,
“default”: “Find us”
},
{
“type”: “image_picker”,
“id”: “store_image”,
“label”: “Store image”,
“info”: “700 x 500px .jpg recommended”
},
{
“type”: “richtext”,
“id”: “store_info”,
“label”: “Text”
}
],
“blocks”: [
{
“type”: “text”,
“name”: “Text field”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Name”,
“label”: “Phone”,
“default”: “Custom field”
},
{
“type”: “checkbox”,
“id”: “use_long_text”,
“label”: “Use long text”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “is_required”,
“label”: “Field is required”,
“default”: false
}
]
},
{
“type”: “dropdown”,
“name”: “Dropdown”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Name”,
“label”: “Phone”,
“default”: “Custom field”
},
{
“type”: “text”,
“id”: “values”,
“label”: “Values”,
“info”: “Separate each value by a comma.”,
“default”: “value 1, value 2, value 3”
}
]
}
]
}
{% endschema %}
Hello @Lil1977
As per my understanding, it is not working because there is no value in the option. It requires 1 blank value to work.
I corrected the code. Please try the below code it should work :
Output :
Thanks
Hi yes thast works , many thanks how do i get a label next to the drop down to say sometning like " Im intetested in" . thanks for you help
@Lil1977 I edited my previous answer, Added code to the display label. Please see if it helps
actaully its on i can use it as alabel inside the drop dow, thanks for you help
See coding is a super easy thing ![]()
Glad to help @Lil1977
Thanks