[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 725
  • Last Modified:

Trying to hide OBJECT, but object is CRViewer.

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
mor4eus
Asked:
mor4eus
  • 12
  • 11
1 Solution
 
rabaneroCommented:
Change your onMouseOver event by this:

onMouseOver="this.style.visibility = 'hidden'"
0
 
mor4eusAuthor Commented:
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
 
rabaneroCommented:
<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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
rabaneroCommented:
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
 
mor4eusAuthor Commented:
How would I use a button to show it again.  Like an img or something.
0
 
mor4eusAuthor Commented:
How would I use a button to show it again.  Like an img or something.
0
 
rabaneroCommented:
<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
 
mor4eusAuthor Commented:
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
 
rabaneroCommented:
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
 
rabaneroCommented:
I don't say buttons have to be written in body of top.html, but its obvious.
0
 
mor4eusAuthor Commented:
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
 
rabaneroCommented:
top CFM??

Please print your html pages here (top, bottom and frameset)
0
 
rabaneroCommented:
The error is during load or when you press any button?
0
 
mor4eusAuthor Commented:
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
 
rabaneroCommented:
you have written "parent.content" instead of "parent.bottom" in top.cfm!
0
 
rabaneroCommented:
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
 
mor4eusAuthor Commented:
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
 
rabaneroCommented:
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
 
mor4eusAuthor Commented:
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
 
mor4eusAuthor Commented:
Sorry, got to this before I refreshed the page or got the email.  Thanks for all your help.
0
 
rabaneroCommented:
Well, I think I have earned each one of the 50 points. I leave to rest :)
0
 
mor4eusAuthor Commented:
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
 
mor4eusAuthor Commented:
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 12
  • 11
Tackle projects and never again get stuck behind a technical roadblock.
Join Now