Search the Community
Showing results for tags 'javascrip'.
-
Thought others might find this useful. If you have a complicated table (using separate html blocks for the tr,td, etc) set up in a Details report you're unable to use Rules to show/hide sections. Because if a Section is inside the overall table (between the html blocks with table,tr,td) then when hidden it hides the entire table and therefore all of your fields within it. This is really a problem in terms of being able to have 'smart' reports. A workaround is to put a div in an html block and then show/hide it based on whatever criteria you would have used in a Rule. In this example that would be using a field that's a number and judging if it's null/not-null. So instead of a rule use 2 divs to show/hide what you want. The 1st div has it's own objects (and you could put virtual fields, regular fields, buttons, etc within it) and the 2nd div shows different objects (or it could just be text or blank if desired). Here's what to do: The field for the criteria needs to be on the results list and in this example is a number value, set to 'Hidden.' In an html block uncheck the html editor. Use section id's for the divs: <div id="section1">Objects specific to this div</div> <div id="section2">Objects specific to this div, or blank if desired</div> Then in the footer put your code: <script> var v_divhideid = parseFloat(document.getElementById("EditRecordMyFieldName").value); if(!isNaN(v_divhideid)) { document.getElementById('section1').style.display = "block"; document.getElementById('section2').style.display = "none"; } else { document.getElementById('section1').style.display = "none"; document.getElementById('section2').style.display = "block"; } </script> This enables you to show different objects depending on the value of a field, like a Rule, but using divs instead.