Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
use jquery hide(), show()...toggle