Could someone help me change my contact us page so that when a user hits “send” prior to filling out the required fields (first and last name, email, and message) a red box pops up in all of the sections with a message below, exactly like the attached image?
Hey @flammagreg to display a popup with a message when the user tries to submit the form without filling out the required field
follow these steps
1 . Add error message spans in the form:
Navigate to your Shopify admin panel.
Go to Online Store > Themes.
Click on Actions > Edit Code for the theme you are currently using.
In the left sidebar, find and click on Templates and then select page.contact.liquid.
Add the error message spans within the input wrapper divs for each required field in your page.contact.liquid file like this
This field is required.
This field is required.
This field is required.
This field is required.
2. Add the popup HTML:
Add the popup HTML somewhere within your page.contact.liquid file, preferably just before the closing tag
Please fill out all required fields.
3 . Add JavaScript for validation and popup:
Go to your Shopify admin panel again
Go to Online Store > Themes.
Click on Actions > Edit Code
Click on Assets and then select theme.js or create a new one but make sure to link it