You are viewing limited content. For full access, please sign in.

Question

Question

Forms 10 Table Field Rules

asked on February 5, 2016

I have a form that has a table with several columns and rows.  In this table are a series of Yes/No questions (Dropdown list fields).  I want to hide or display different sections on the form based on the answers in the table.  For example: If all rows and columns in a table = Yes then display the next section on the form.

In the Field Rules in the Form Designer, I have the option to add these rules; but the hide/show function does not work.  Any thoughts?

0 0

Replies

replied on February 5, 2016 Show version history

Hi Lance,

When you apply field rules to a table field, the rules only affect fields within that table row. You will need to use JavaScript to achieve what you're looking for. Click here for more information on using JavaScript with Forms. Here is one way of doing it:

$(document).ready(function(){
  var $hidden = $('#q5');
  var $dropDown = $('.dropDown select');
  $hidden.hide();
  
  $(document).on('change',$dropDown,function(){
    $hidden.show();
    $dropDown.each(function(){
      if ($(this).val() != 'Yes'){
        $hidden.hide();
      }
    });
  });
});

Replace #q5 on line 2 with the ID of your hidden field, and replace .dropDown on line 3 with the class you assigned your drop-down column. You can assign classes to a field by typing them into "CSS class" in the field's "Advanced" options tab.

Let me know if this works for you!

1 0
replied on February 5, 2016

if you try to show/hide same field it might cause unpredicatble behaviour. Try using seperate fields for shownig and hiding. 

0 0
replied on February 5, 2016

These are separate sections that I am showing hiding not fields.  Seems that any fields in a table will not control show/hide of anything else on the form.  Not sure if this is a bug or not.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.