Copy link to clipboard
Copied
Is it possible to use liquid to show/hide a form field? I can get this to hide the second question but I need it to display if the tick box is "yes". Not sure about the correct format.
//first question is a yes/no
<label>Are you happy?<span class="req">*</span></label>
<label class="radio inline"><input name="test1" id="test1-0" value="Yes" type="radio" />Yes</label>
<label class="radio inline"><input name="test1" id="test1-1" value="No" type="radio" />No</label>
//if Yes selected, show the second question
{% if {{form.test1_0}}.checked -%}
<label >Q1 - If yes, tell us why.</label><br />
<textarea name="why" id="why" cols="10" rows="4" class="cat_listbox" onkeydown="if(this.value.length>=4000)this.value=this.value.substring(0,3999);"></textarea>
{% endif %}
Copy link to clipboard
Copied
Liquid is processed server-side before the page is rendered, and is not available to or understood by the client.
You could do that either with javascript-jquery or carefully constructed css - using the more advanced selectors.