Form Rule action to Collapse sections

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
Is there a way to trigger a section to collapse/expand using a form rule?
I have a number of rules that show/hide fields based on conditions usually triggered by user interaction with the form.  But I just realized that the user cannot 'show' these fields manually if they need to.  This is when it clicked that I don't actually want to show/hide the fields, I just want to collapse/expand them for easier use, but still allow the user to reveal them as needed.  I want to do it in entire sections so I could even go for 'if condition = true then collapse section header' (and everything in that section).  I don't think it's possible but I'm very often wrong.  Thanks in advance for any suggestions!
Photo of Richard Pfister

Richard Pfister

  • 554 Points 500 badge 2x thumb
  • curious

Posted 1 year ago

  • 0
  • 1
Photo of Chuck Grigsby

Chuck Grigsby

  • 1,978 Points 1k badge 2x thumb
You can choose to hide and show sections in form rules. Have you tried that yet?
Photo of Richard Pfister

Richard Pfister

  • 554 Points 500 badge 2x thumb
I have not seen an option to hide a *section*.  But even so, would the user be able to unhide it?  I really just want rule-based collapse so the user can uncollapse.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 50,178 Points 50k badge 2x thumb
Form Rules can hide fields or sections.  But there is not a native way to collapse section with form rules.  However, you can now default sections to default to collapsed all the time, and the user can open them if they want.  That  is a new Form setting for the section.
(Edited)
Photo of Richard Pfister

Richard Pfister

  • 554 Points 500 badge 2x thumb
Ah yes, I see the sections now.  I do default the sections to collapsed but I want to uncollapse them both with a rule and by the users hand.  I'm going to think through the button approach Joey suggested and see if I can get it to work.
Photo of Joey Zint

Joey Zint

  • 1,508 Points 1k badge 2x thumb
You could create a formula text button to change a hidden checkbox to yes or no and collapse the sections based on a form rule on the condition of the checkbox. Simply create a button and checkbox for each section.

Just do a case or if formula
Photo of Richard Pfister

Richard Pfister

  • 554 Points 500 badge 2x thumb
I think the piece that I'm missing is I don't see an Action in the form rule logic that allows collapsing a section.  I see show, hide, un/require, make read only/editable, change, and display message.  I don't want to hide because then the user cannot unhide it if needed.
Photo of Joey Zint

Joey Zint

  • 1,508 Points 1k badge 2x thumb
Yes you can hide a section...your code in your button would be press to hide, press to unhide....

Something like this

If([Project Checkbox] = false,
    "<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=your app token&_fid_44=1"'>Close Section</a>",
    "<a class='Vibrant Success' href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=your app token&_fid_44=0"'>Open Section</a>"
)

The fid is the field ID of the checkbox

Your form rule would be to hide that section when the box is checked. When the button is pressed again, the box would be unchecked, the rule would see false and open the section. The code above is to edit the record. I have not tried this but it should work. Probably need to take out the edit record part since you are not actually editing the record only closing the section.

The Project Checkbox field would have to be recreated for each section with a different name and you would need a button and form rule for each section
(Edited)
Photo of Richard Pfister

Richard Pfister

  • 554 Points 500 badge 2x thumb
Thanks Joey, I'll take a run at this.
Photo of Joey Zint

Joey Zint

  • 1,508 Points 1k badge 2x thumb
Here is a screen shot...it works fine. Think I have my Open and Close wrong on my button

You can put the button and check box at the top and hide all of the labels to clean it up


Photo of Joey Zint

Joey Zint

  • 1,508 Points 1k badge 2x thumb
Here is the form rule for the one checkbox