• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

using liquid to show/hide form field

Explorer ,
Sep 07, 2017 Sep 07, 2017

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&gt;=4000)this.value=this.value.substring(0,3999);"></textarea>

     

   

   {% endif %}

TOPICS
Developer

Views

451

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 07, 2017 Sep 07, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines