Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I have Shopify customer form set up to get emails for our product recommendation quiz.
The issue I'm running into is the inability to run a function or redirect the user when they submit their email through the form (the native functionality is just refreshing the page with a success message)
I need to run the goToCart() function on form submit, and none of these method below work:
{%- form 'customer', class: 'quiz-form', onsubmit:'goToCart();'-%}
<label for="quiz_email_input">Email</label>
<input type="hidden" name="contact[tags]" value="sweatquiz">
<input
type="email"
name="contact[email]"
class="quiz_email_input"
value="{{ form.email }}"
autocorrect="off"
autocapitalize="off"
autocomplete="email"
>
<div class="next_button_background" style="text-align:center;">
<button type="submit" class="next_button" onclick="goToCart();" style="margin-bottom: 10px;">SEE RESULTS</button>
</div>
{%- if form.posted_successfully? -%}
<script>(function(){goToCart();})</script>
{%- endif -%}
{%- endform -%}
Do you have solution?
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024