Hi, I’m working with the Refresh theme and would like to hide the contact form after submitting it - when the post success message is shown. Any pointers on how to achieve that?
Thanks!
/Gabriel
Hi, I’m working with the Refresh theme and would like to hide the contact form after submitting it - when the post success message is shown. Any pointers on how to achieve that?
Thanks!
/Gabriel
Hi Gabriel,
I did this in my store like that-
Follow these steps to do that.
{{ '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 }}
- {{ form.errors.translated_fields.email | capitalize }}
{{ form.errors.messages.email }}
{%- endif -%}
{% unless form.posted_successfully? %}
{%- if form.errors contains 'email' -%}
<small>
{{ 'accessibility.error' | t }}
{%- render 'icon-error' -%}
{{- form.errors.translated_fields.email | capitalize }}
{{ form.errors.messages.email -}}
</small>
{%- endif -%}
{% endunless %}
{%- 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 %}
keep in mind: This code works only for Refresh version 12.0.0
If you need further help. ask me. If you need any additional design. You can ask that also.
Thanks
Thanks after some fiddling it did the trick!