Skip to main content
Inspiring
April 21, 2011
Question

hide and show content

  • April 21, 2011
  • 3 replies
  • 919 views

Hi,

I have the results page to display all records from the search and also I have the User Friendly Print button,  but content will hide or show depend on what action user clicked on.

For example:

<table name=”1”>

Display all results in the regular format

</table

<if isdefined(“print”)>

<table name=”2”>

Display all results in the print friendly format

</table

</cfif>

<input name=”print”>

<input name=”result”>

With this process, the code it worked well, but I don’t know how to hide the blog of table 1?

thanks

This topic has been closed for replies.

3 replies

Fernis
Inspiring
April 24, 2011

To be honest, separate _browser_ layouts for printing is pointless and So last decade.

I recommend using css to change the page appearance when printed. No new windows or refreshes needed.

http://www.w3.org/TR/CSS2/media.html

-Fernis

Inspiring
April 25, 2011

use jquery hide(), show()...toggle

Participating Frequently
April 21, 2011

I am not 100% sure in which you want to hide table. If you want to hide table in onClick of some html elements then you can use javascript to add style properties for table. Using javascript you can set display as none.

Please let me know if your requirement is different.

Inspiring
April 23, 2011

I use this lttle script...

<script language="javascript">
function togglemas() {
var ele = document.getElementById("togglemas");
var text = document.getElementById("displaymas");
if(ele.style.display == "block") {
      ele.style.display = "none";
  text.innerHTML = "Show Master Data";
   }
else {
  ele.style.display = "block";
  text.innerHTML = "Hide Master Data";
}
}
</script>

<a id="displaymas" href="javascript:togglemas();">Show Master Data</a>
<div id="togglemas" style="display: none">

Display Whatever...

</div>

ilssac
Inspiring
April 21, 2011

In your simple code example, wrap the first table in a <cfif...> block that will be FALSE then the print control as been selected.

I.E.

<cfif isDefined("print") EQ false>