Assigning form value to variable in 2.0 theme

Assigning form value to variable in 2.0 theme

jplourenco
Shopify Partner
7 0 0

Hi all,

 

I really need help on this.

 

So I have a form which is submitted:

<form name="forminput">
  <input id="formid" name="inputname" value="">
</form>

 

 

Once it is submitted (done automatically using js), I want to assign that value to a variable but no luck so far... What I've tried but didn't work is:

 

 

{% assign variable = form.body %}
{% assign variable = form[formid] %}
{% assign variable = form.body.formid %}

 

 

Really need help! Not sure what to try anymore... I can see the form was submited on the url, however the variable has no value as I'm test printing the variable on a h1 tag and it keeps empty...

 

Please help, thank you!

Replies 0 (0)