Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

hide and show content

Explorer ,
Apr 21, 2011 Apr 21, 2011

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

TOPICS
Advanced techniques
805
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 21, 2011 Apr 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>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 21, 2011 Apr 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 22, 2011 Apr 22, 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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 24, 2011 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 25, 2011 Apr 25, 2011
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources