?
Solved

Trying to hide OBJECT, but object is CRViewer.

Posted on 2001-09-11
23
Medium Priority
?
719 Views
Last Modified: 2012-06-27
I was wondering if it was possible to assosciate an action that would hide the Crystal Reports ActiveX viewer.  I have tried using :
<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" id="CRViewer"
onMouseOver="changeObjectVisibility('CRViewer', 'hidden')">

<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=0>
<PARAM NAME="EnableZoomControl" VALUE=0>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</object>

But IE says object not defined.  Is this possible??
0
Comment
Question by:mor4eus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 11
23 Comments
 
LVL 2

Expert Comment

by:rabanero
ID: 6475874
Change your onMouseOver event by this:

onMouseOver="this.style.visibility = 'hidden'"
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6475897
That works good, but how would I implement as javascript, is it like this,

<script type="text/javascript" language="JavaScript">
<!--
function crviewer_onmouseover()
{
this.style.visibility = 'hidden'
}
-->
</script>

<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" id="CRViewer" onMouseOver="CRViewer_onmouseover()">
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6475915
<script type="text/javascript" language="JavaScript">
<!--
function CRViewer_onmouseover(elem)
{
elem.style.visibility = 'hidden'
}
-->
</script>

<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" onMouseOver="CRViewer_onmouseover(this)">


You have not to write "id=", it's "name=". But, as you see, you don't need anyone.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:rabanero
ID: 6475919
A switch;

script type="text/javascript" language="JavaScript">
<!--
function setVisible(elem, flag)
{
elem.style.visibility = flag ? '' : 'hidden';
}
-->
</script>

<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" onMouseOver="setVisible(this, false)">

setVisible(this, true) enables object.
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6475928
How would I use a button to show it again.  Like an img or something.
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6475934
How would I use a button to show it again.  Like an img or something.
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6475982
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
function setVisible(elem, flag)
{
elem.style.visibility = flag ? '' : 'hidden';
}
-->
</script>
</head>
<body>
<object id="CRViewer" classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%">
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=0>
<PARAM NAME="EnableZoomControl" VALUE=0>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</object>
<input type="button" onclick="setVisible(document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(document.all['CRViewer'], false)" value="Hide">
</body>
</html>

Use <img onclick=....  if you want.

Bye
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478140
This works fine, you get the points.  But how would I do this with frames.  I want to click on something in the top frame and make it happen in the bottom frame.  Thanks
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478565
Well, I will explain you with an example. Suposse we have this frameset:

<frameset>
    <frame name="top" src="top.html">
    <frame name="bottom" src="bottom.html">
</frameset>

In top.html we will have buttons that show/hide contents in bottom.html, ok?.

Imagine in bottom.html we have located object id="CRViewer", written as above. You don't need javascript code here.

In top.html you have to write setVisible function. Then, you can write buttons to show/hide object in bottom, like this:

<input type="button" onclick="setVisible(parent.bottom.document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(parent.bottom.document.all['CRViewer'], false)" value="Hide">

Try it and tell me your progress.

Bye.
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478572
I don't say buttons have to be written in body of top.html, but its obvious.
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478581
Ok, this is what i was trying but I get an error in i.e.
It says
Error: object expected
Code: 0
URL: top.cfm
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478595
top CFM??

Please print your html pages here (top, bottom and frameset)
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478599
The error is during load or when you press any button?
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478610
When I press.
--top.cfm--
<html>
<head>
</head>
<body>
<input type="button" onclick="setVisible(parent.content.document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(parent.content.document.all['CRViewer'], false)" value="Hide"></td>
</body>
</html>


--Bottom --

<html>
<head>
<TITLE>Crystal Report Viewer</TITLE>
<script type="text/javascript" language="JavaScript">
<!--
function setVisible(elem, flag)
{
elem.style.visibility = flag ? '' : 'hidden';
}
-->
</script>
<input type="button" onclick="setVisible(document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(document.all['CRViewer'], false)" value="Hide">
<input type="button" onMouseOver="setVisible(document.all['CRViewer'], false)" onMouseOut="setVisible(document.all['CRViewer'], true)" value="Test">

</head>
<img src="images/fmrlogo.gif" onClick="_onclick()">
<br><br><br>

<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript topmargin=0 leftmargin=0>

<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" id="CRViewer">

<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=0>
<PARAM NAME="EnableZoomControl" VALUE=0>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</object>


<SCRIPT LANGUAGE="VBScript">
<!--

Sub window_onLoad()
     Page_Initialize()
End Sub

Sub Page_Initialize
    On Error Resume Next
    Dim webBroker
    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
    if err.number <> 0 then
        window.alert "The Crystal ActiveX Viewer is unable to create it's resource objects."
        CRViewer.ReportName = "/menu/jf.rpt"
    else
        Dim webSource0
          Set webSource0 = CreateObject("WebReportSource.WebReportSource")
          webSource0.ReportSource = webBroker
          webSource0.URL = "/menu/jf.rpt"
          webSource0.PromptOnRefresh = True
         
          CRViewer.ReportSource = webSource0
    end if
    CRViewer.ViewReport
End Sub

-->
</SCRIPT>
<OBJECT ID="ReportSource"
     CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"
     HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ViewHelp"
     CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"
     HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ReportParameter"
     CLASSID="CLSID:71C140F3-1A84-430b-9035-68815582DC79"
     HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/reportparameterdialog.cab#Version=8,0,2,672">
</OBJECT>
<div>
<!-- this empty div prevents IE from showing a bunch of empty space for the controls above.. I don't know why though. -->
</div>
</body>
</html>
 

--index.cfm--

<frameset rows="55,*" border="0">
<frame src="top.cfm" name="top" id="top" scrolling="No"></frame>
<frame name="bottom" src="bottom.cfm"></frame>
</frameset>
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478625
you have written "parent.content" instead of "parent.bottom" in top.cfm!
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478633
And remove id="top" in frameset:

<frameset rows="55,*" border="0">
<frame src="top.cfm" name="top" scrolling="No"></frame>
<frame name="bottom" src="bottom.cfm"></frame>
</frameset>
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478642
Yeah that was a pasting mistake.  I took out all the non relevant material and changed it.  It should be content.  I have been changing the others as well.  I will paste again. sorry
---index.cfm----
<frameset rows="55,*" border="0">
<frame src="topfr.cfm" name="topFr" id="topFr" scrolling="No"></frame>
<frame name="content" src="report.cfm"></frame>
</frameset>


---topfr.cfm----

<html>

<head>
<link rel="stylesheet" href="style.css"></link>
<script language="JavaScript1.2" src="subfr.js"></script>
</head>

<body style="background: #000000; color: white; margin: 0">

<table height="34" width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FEC400">
<td rowspan="2" width="35"><a href="http://sydback/newintranet/index.cfm"><img src="./images/fmrlogo.gif"  width="30" height="26" border="0"></a></td>
<td rowspan="2" valign="middle"><font face="Arial" size=5 color="#000000"><b><cfoutput>#pagetitle#</cfoutput></b></font>
<input type="button" onclick="setVisible(parent.content.document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(parent.content.document.all['CRViewer'], false)" value="Hide"></td>
<td align="right" valign="bottom"><font face="Arial" size=1 color="#000000"><cfoutput>#fmruser#</cfoutput></font></td></tr>
<tr><td align="right"><font face="Arial" size=1 color="#000000"><a href="index.cfm">Logon</a></font></td></tr>
</table>

</body>
</html>


---report.cfm ----

<html>
<head>
<TITLE>Crystal Report Viewer</TITLE>
<link rel="stylesheet" href="style.css"></link>
<script language="JavaScript1.2" src="subfr.js"></script>

<script type="text/javascript" language="JavaScript">
<!--
function setVisible(elem, flag)
{
elem.style.visibility = flag ? '' : 'hidden';
}
-->
</script>
<input type="button" onclick="setVisible(document.all['CRViewer'], true)" value="Show">
<input type="button" onclick="setVisible(document.all['CRViewer'], false)" value="Hide">
<input type="button" onMouseOver="setVisible(document.all['CRViewer'], false)" onMouseOut="setVisible(document.all['CRViewer'], true)" value="Test">

</head>
<img src="images/fmrlogo.gif" onClick="_onclick()">
<br><br><br>

<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript topmargin=0 leftmargin=0>

<object classid="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
codebase="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217"
width="100%" height="98%" id="CRViewer">

<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=0>
<PARAM NAME="EnableZoomControl" VALUE=0>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</object>


<SCRIPT LANGUAGE="VBScript">
<!--

Sub window_onLoad()
      Page_Initialize()
End Sub

Sub Page_Initialize
    On Error Resume Next
    Dim webBroker
    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
    if err.number <> 0 then
        window.alert "The Crystal ActiveX Viewer is unable to create it's resource objects."
        CRViewer.ReportName = "/menu/jf.rpt"
    else
        Dim webSource0
            Set webSource0 = CreateObject("WebReportSource.WebReportSource")
            webSource0.ReportSource = webBroker
            webSource0.URL = "/menu/jf.rpt"
            webSource0.PromptOnRefresh = True
            
            CRViewer.ReportSource = webSource0
    end if
    CRViewer.ViewReport
End Sub

-->
</SCRIPT>
<OBJECT ID="ReportSource"
      CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"
      HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ViewHelp"
      CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"
      HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ReportParameter"
      CLASSID="CLSID:71C140F3-1A84-430b-9035-68815582DC79"
      HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/reportparameterdialog.cab#Version=8,0,2,672">
</OBJECT>
<div>
<!-- this empty div prevents IE from showing a bunch of empty space for the controls above.. I don't know why though. -->
</div>
</body>
</html>
 
0
 
LVL 2

Accepted Solution

by:
rabanero earned 200 total points
ID: 6478658
Well, you dont have defined setVisible in top page. I said you to copy setVisible Javascript code there. You're calling a function that doesn't exist in this page.

Optionally, you can export setVisible function to a .js file and import in both sides, same as you are doing with "subjr.js"
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478660
Fixed it.  I think. I put the
<script type="text/javascript" language="JavaScript">
<!--
function setVisible(elem, flag)
{
elem.style.visibility = flag ? '' : 'hidden';
}
-->
</script>

In the top frame and it now works.
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478661
Sorry, got to this before I refreshed the page or got the email.  Thanks for all your help.
0
 
LVL 2

Expert Comment

by:rabanero
ID: 6478663
Well, I think I have earned each one of the 50 points. I leave to rest :)
0
 
LVL 1

Author Comment

by:mor4eus
ID: 6478677
Yes, maybe a few more were in order. That was great help.  Next time, I need a few more to give though.  Must answer a few more.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question