Changing 'phone number' field on contact form to plain text

Hi!

I’m using the default contact form which is great for my needs but I would love to swap the ‘phone number’ field for plain text. I’ve changed the ‘phone number’ text to ‘order number’ but it still auto-fills as a phone number when interacting with the contact form.

What I want to do is change that specific field from tel type to text type.

Does anybody know where and how I can change that in the code? I know the relevant code is in the ‘contact.form.liquid’ template but I’m afraid of messing it up. Any insight would be appreciated!

More info: using the Sense theme.

Hello,

Please provide the code in the contact.form.liquid

Sure! Here’s the default code:

{{ ‘section-contact-form.css’ | asset_url | stylesheet_tag }}

{%- style -%}
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
}

@media screen and (min-width: 750px) {
.section-{{ section.id }}-padding {
padding-top: {{ section.settings.padding_top }}px;
padding-bottom: {{ section.settings.padding_bottom }}px;
}
}
{%- endstyle -%}

{%- if section.settings.heading != blank -%}

{{ section.settings.heading }}

{%- else -%}

{{ 'templates.contact.form.title' | t }}

{%- endif -%} {%- liquid assign contact_form_class = 'isolate' if settings.animations_reveal_on_scroll assign contact_form_class = 'isolate scroll-trigger animate--slide-in' endif -%} {%- form 'contact', id: 'ContactForm', class: contact_form_class -%} {%- if form.posted_successfully? -%}

{% render 'icon-success' %} {{ 'templates.contact.form.post_success' | t }}

{%- elsif form.errors -%}

{% render 'icon-error' %} {{ 'templates.contact.form.error_heading' | t }}

{%- endif -%}
{{ 'templates.contact.form.name' | t }}
{{- 'templates.contact.form.email' | t }} * {%- if form.errors contains 'email' -%} {{ 'accessibility.error' | t }} {%- render 'icon-error' -%} {{- form.errors.translated_fields.email | capitalize }} {{ form.errors.messages.email -}} {%- endif -%}
{{ 'templates.contact.form.phone' | t }}
{{- form.body -}} {{- 'templates.contact.form.comment' | t -}}
{{ 'templates.contact.form.send' | t }}
{%- endform -%}

{% schema %}
{
“name”: “t:sections.contact-form.name”,
“tag”: “section”,
“class”: “section”,
“disabled_on”: {
“groups”: [“header”, “footer”]
},
“settings”: [
{
“type”: “inline_richtext”,
“id”: “heading”,
“default”: “Contact form”,
“label”: “Heading”
},
{
“type”: “select”,
“id”: “heading_size”,
“options”: [
{
“value”: “h2”,
“label”: “t:sections.all.heading_size.options__1.label”
},
{
“value”: “h1”,
“label”: “t:sections.all.heading_size.options__2.label”
},
{
“value”: “h0”,
“label”: “t:sections.all.heading_size.options__3.label”
}
],
“default”: “h1”,
“label”: “t:sections.all.heading_size.label”
},
{
“type”: “color_scheme”,
“id”: “color_scheme”,
“label”: “t:sections.all.colors.label”,
“default”: “background-1”
},
{
“type”: “header”,
“content”: “t:sections.all.padding.section_padding_heading”
},
{
“type”: “range”,
“id”: “padding_top”,
“min”: 0,
“max”: 100,
“step”: 4,
“unit”: “px”,
“label”: “t:sections.all.padding.padding_top”,
“default”: 36
},
{
“type”: “range”,
“id”: “padding_bottom”,
“min”: 0,
“max”: 100,
“step”: 4,
“unit”: “px”,
“label”: “t:sections.all.padding.padding_bottom”,
“default”: 36
}
],
“presets”: [
{
“name”: “t:sections.contact-form.presets.name”
}
]
}
{% endschema %}

Hello,

Change the type=“tel” to type=“text” in the input tag. The line number in the code is the 102.

I think that would do the trick for you.

Hope it helps.

It did, thank you!

I also removed autocomplete=“tel” from the code to prevent auto-filling with a phone number, for anyone who might need it.

Thanks again.

1 Like

You are welcome!