Hi folks, I have a question related to the contact form. I have added the contact form in a pop-up on the homepage. Now the issue I am facing is that when the user submits the form whether it is successfully submitted or not the end user is unable to see the response as the page gets refreshed on form submission. How can this be handled?
Ignore the design it is still under development.
Write a js script on form successfully submit condition where you can show a popup with your message
This is what Liquid provides concerning whether the form was submitted successfully. How can I use this in JS to show the successful or failed message? Or do I need to find the even in the theme.js for this purpose? Also, after the page reloads i get the response in the footer where i have used the newsletter section. Do i need to change something in the contact form in the pop up so that the error or success message does not appear in the footer as well?
{%- if form.posted_successfully? -%}
posted succesfully but this will only work after the page is reloaded.
{%- elsif form.errors -%}
errors and this will only work after the page is reloaded.
{%endif%}
This is the only way to show popup.
As on submit it reload the page