Jump to content

Rules: How to hide Sections with required fields

Recommended Posts



I was trying to implement Rules on a Submission Form DataPage and was trying to hide a Section with required fields. I was wondering why I can't do so until a Support person pointed out on an article that it is not possible to hide a Section if there are required fields inside it.


I was wondering if there is something JavaScript can do with this.


Thanks in advance.




Link to comment
Share on other sites

Hi @TroubleShooter


You can to paste>modify this code in the Footer of your Submission Form (disable HTML Editor).

Virtual4 is a checkbox, but you may opt to use other field elements such as text fields. Just comment/uncomment the corresponding alternate lines.



  var cbx = document.querySelector('[id*=cbParamVirtual4]')
//var textbox = document.querySelector('[id*=InsertRecordmyField]')
  var tbl = document.querySelector('[id*=hideThisTable]')

//textbox.onchange = function(){
cbx.onchange = function(){
//if (textbox.value == "hidemyfield")
  if (cbx.checked == false)
    tbl.style.display = "none";

   tbl.style.display = "block";

var event = new Event('change');



Next thing is to wrap all the fields you wish to hide in 2 HTML blocks (Remember to disable HTML Editor from the Advanced tab).

*Note that it is able to span across sections.

HTML Block 1:

<table id="hideThisTable">




TL;DR / Preview



Once your page loads, if you check/uncheck Virtual4, it should toggle showing/hiding what's sandwiched within the <table> tag.


Hope this helps.




Link to comment
Share on other sites

  • 3 weeks later...

First .. if you hide REQUIRED fields, then your form may never get submitted, as there could be a situation where they're not displayed. - That's why it's not something which is done.


For your situation - the fix is super easy.

(1) Create a checkbox/button in the form named "section2btn" or whatever you want (it can be virtual or part of your table)

Example:  Show More Questions:   [    ]  Yes

(2) Below the above checkbox -> Create a section (example "SECTION2") with your specific form questions applied to it - the ones you wish to hide and have required.



(3) Once you're done with all of your questions - make none of them required - then go back and select your check box above (named "section2btn") and create 2 rules for it.

(3a) Create Rule #1


Criteria   line_separator.gif?a=16.0
"section2btn" is not checked
Actions   line_separator.gif?a=16.0
Make Section2 hidden

(3b) Create Rule #2


Criteria   line_separator.gif?a=16.0
"section2btn" is checked
Actions   line_separator.gif?a=16.0
Make Q1 required
Make Q2 required
Make Q3 required
That should work for you.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...