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?
Question
Question
Forms 10 Table Field Rules
Replies
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!
if you try to show/hide same field it might cause unpredicatble behaviour. Try using seperate fields for shownig and hiding.
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.