You can make form sections collapsible and expandable using JavaScript and the FORM_FIELDS_COLLAPSED
parameter.
-
In the Form Designer, add a section called
FORM
at the top of the form. The code below will set it to hidden for every web form action. -
Add a textbox field with the ID
FIELDS_COLLAPSED
to theFORM
section. -
On the Web References tab in the Form Designer configuration panel, check the Include jQuery API and jQuery UI libraries, and add the following code:
<script type="text/javascript"> if (typeof $selectedObject === "undefined") { $(document).ready(function () { // Hide the FORM section $("#FORM").css("display", "none"); // Add the collapse image $("div.SectionHeader").append("<img style='float: right;' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAArElEQVQ4T+3SoQoCQRAG4O8Qq8Vg8Q0Eq9kHEIOPaTFo9AnMms1azCIiC7dwHHe7J1wSN+6yHzP/TKHnU/Ts+R1wjRcOuYi6tBywXQmtsE+hOTBgWwxL5IlNCk2BEXtgiQGOGKXQNrCOncsK5zm0CWzDYnRJtA7msCxaBbtiSTSCIfATpuUAYma5tYvtX7HAu1rhBGNcckrtfYYb7uE+t4df2n/w68AaPvQ+lA+eJicValFKQwAAAABJRU5ErkJggg=='>"); // Collapse the sections defined in FORM_FIELDS_COLLAPSED if ($("#FORM_FIELDS_COLLAPSED").val() != "") { var sections = $("#FORM_FIELDS_COLLAPSED").val().split(","); for (i = 0; i < sections.length; i++) { $("#" + $.trim(sections[i]) + " > div.SectionHeader").find("img").attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAtElEQVQ4T+3ToQrCUBQG4E8Fi9EkvoOYfAGTaPBFTRYNPoJF7GarTRCRwTbm2HavuKaDWzbOx9n5z+1o+em07PmD30+0OMMRhjh/yE5wTU8eSg9HjDHHKRKd4oALZngWO1xhg1skmmEDrLFLmiivTSxaiVWBybsQWovVgU1oI9YEVqHdNIC3mZXDC1297Pf7aeG9GEDVJoTArNNtWrzI0qxbqxgwqV3igX1oP2PBkJN//0HwBYpdJxXft7aqAAAAAElFTkSuQmCC"); $("#" + $.trim(sections[i])).find("div.Fields").css("display", "none"); } } $("div.SectionHeader").click(function () { var $fields = $(this).parent().find("div.Fields"); if ($fields.css("display") == "none") { $(this).find("img").attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAArElEQVQ4T+3SoQoCQRAG4O8Qq8Vg8Q0Eq9kHEIOPaTFo9AnMms1azCIiC7dwHHe7J1wSN+6yHzP/TKHnU/Ts+R1wjRcOuYi6tBywXQmtsE+hOTBgWwxL5IlNCk2BEXtgiQGOGKXQNrCOncsK5zm0CWzDYnRJtA7msCxaBbtiSTSCIfATpuUAYma5tYvtX7HAu1rhBGNcckrtfYYb7uE+t4df2n/w68AaPvQ+lA+eJicValFKQwAAAABJRU5ErkJggg=="); } else { $(this).find("img").attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAtElEQVQ4T+3ToQrCUBQG4E8Fi9EkvoOYfAGTaPBFTRYNPoJF7GarTRCRwTbm2HavuKaDWzbOx9n5z+1o+em07PmD30+0OMMRhjh/yE5wTU8eSg9HjDHHKRKd4oALZngWO1xhg1skmmEDrLFLmiivTSxaiVWBybsQWovVgU1oI9YEVqHdNIC3mZXDC1297Pf7aeG9GEDVJoTArNNtWrzI0qxbqxgwqV3igX1oP2PBkJN//0HwBYpdJxXft7aqAAAAAElFTkSuQmCC"); } $(this).parent().find("div.Fields").toggle("blind", 500); }).mouseover(function() { $(this).css("background-color", "#5892ED"); }).mouseout(function() { $(this).css("background-color", "#72A3EF"); }).attr("title", "Click to collapse or expand").css("cursor", "pointer"); }); } </script>
-
For every web form action, add the
FORM_FIELDS_COLLAPSED
parameter with a comma-separated list of section IDs for the sections you want to display collapsed when the form is first loaded.
Download the 2 Levels Approval Collapsed sample process, unzip it, and import the XPDL into WorkflowGen to see it in action.