Solved

Trying to hide OBJECT, but object is CRViewer.

Posted on 2001-09-11
23
706 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
  • 12
  • 11
23 Comments
 
LVL 2

Expert Comment

by:rabanero
Comment Utility
Change your onMouseOver event by this:

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

Author Comment

by:mor4eus
Comment Utility
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
Comment Utility
<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
 
LVL 2

Expert Comment

by:rabanero
Comment Utility
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
Comment Utility
How would I use a button to show it again.  Like an img or something.
0
 
LVL 1

Author Comment

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

Expert Comment

by:rabanero
Comment Utility
<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
Comment Utility
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
Comment Utility
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
Comment Utility
I don't say buttons have to be written in body of top.html, but its obvious.
0
 
LVL 1

Author Comment

by:mor4eus
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:rabanero
Comment Utility
top CFM??

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

Expert Comment

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

Author Comment

by:mor4eus
Comment Utility
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
Comment Utility
you have written "parent.content" instead of "parent.bottom" in top.cfm!
0
 
LVL 2

Expert Comment

by:rabanero
Comment Utility
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
Comment Utility
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 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Well, I think I have earned each one of the 50 points. I leave to rest :)
0
 
LVL 1

Author Comment

by:mor4eus
Comment Utility
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
 
LVL 1

Author Comment

by:mor4eus
Comment Utility
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now