Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

openModalDialog

Posted on 2006-07-06
7
Medium Priority
?
1,478 Views
Last Modified: 2012-08-13
I'm trying to get testpage.cfm to open in the dialog box but I
can't figure it out.


<script>
window.showModalDialog( )
// -------------------------------------------------------------------------
     //  Name: OpenModalDialog
     //  Abstract: Open the specified page in a modal window
     // -------------------------------------------------------------------------
     function OpenModalDialog( strPage, intHeight, intWidth, objDialogArguments )
     {
          var objResult = 0;
          try
          {
               var strDialogOptions = "" +
                         "border=thin;" +
                         "center=yes;" +
                         "dialogHeight=" + intHeight + "px;" +
                         "dialogWidth=" + intWidth + "px;" +
                         "help=no;" +
                         "maximize=no;" +
                         "minimize=no;" +
                         "status=no;";
               objResult = window.showModalDialog( strPage, objDialogArguments, strDialogOptions );
          }
          catch( expError )
          {
               alert( "ClientUtilities1.js::OpenModalDialog( ).\n" +
                         "Error:" + expError.number + ", " + expError.description );
          }
          finally
          {
               // Return result
               return objResult;
          }
     } // OpenModalDialog
       </script>
      
       <cfform name = "test" id = "test">
            
            <cfset strPage = "testpage.cfm">
            <cfset intHeight = 5>
            <cfset intWidth = 5>
            <cfset objDialogArguments= 5>
     
               
                     <input type="radio" name="WorldPremiere" id="WorldPremiere1" Value=1  onClick="OpenModalDialog()">Yes &nbsp;&nbsp;&nbsp;&nbsp;

      
       </cfform>
0
Comment
Question by:djb80
[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
  • 4
7 Comments
 

Author Comment

by:djb80
ID: 17049999
Here is the info on testpage.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<cfoutput>Hello</cfoutput>
</body>
</html>
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 17050156
add  <base target="_self"> in your scripting page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>Contacts</title>
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <base target="_self">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <META http-equiv="imagetoolbar" content="no">
      </HEAD>
0
 

Author Comment

by:djb80
ID: 17050871
I'm getting servlet error 404
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

by:djb80
ID: 17051073
I insert testpage in to the javascript and I get the error testpage is undefined

<script>
window.showModalDialog( )
// -------------------------------------------------------------------------
     //  Name: OpenModalDialog
     //  Abstract: Open the specified page in a modal window
     // -------------------------------------------------------------------------
     function OpenModalDialog( strPage, intHeight, intWidth, objDialogArguments )
     {
          var objResult = 0;
          try
          {
               var strDialogOptions = "" +
                         "border=thin;" +
                         "center=yes;" +
                         "dialogHeight=" + intHeight + "px;" +
                         "dialogWidth=" + intWidth + "px;" +
                         "help=no;" +
                         "maximize=no;" +
                         "minimize=no;" +
                         "status=no;";
               objResult = window.showModalDialog(testpage.cfm);
          }
          catch( expError )
          {
               alert( "ClientUtilities1.js::OpenModalDialog( ).\n" +
                         "Errors:" + expError.number + ", " + expError.description );
          }
          finally
          {
               // Return result
               return objResult;
          }
     } // OpenModalDialog
       </script>
      
       <cfform name = "test" id = "test" action="testpage.cfm">
            
            <cfset strPage = "testpage.cfm">
            <cfset intHeight = 5>
            <cfset intWidth = 5>
            <cfset objDialogArguments= 5>
               
                     <input type="radio" name="WorldPremiere" id="WorldPremiere1" Value=1  onClick="OpenModalDialog()">Yes &nbsp;&nbsp;&nbsp;&nbsp;

<cfinput type ="submit" name = "submit" value = "submit">
      
       </cfform>
0
 

Author Comment

by:djb80
ID: 17092951
I found it another way:

Here is what I came up with

question.cfm


<script type="text/javascript">

function OpenModalDialog()
{
  var ReturnedValue = showModalDialog("Modal.html;","Select One",
    "dialogWidth:400px; dialogHeight:225px; status:no; center:yes");
      document.ask.hiddenInput.value = ReturnedValue;
  confirm("Modal Dialog returned " + ReturnedValue);
}

</script>

<cfform action="test_index.cfm" name = "ask">

<cfinput type="radio" value=" Open Modal Dialog" name = "hello" onclick="OpenModalDialog();javascript:document.ask.submit();"/>CHOOSE

<cfset bring_this = "bring_this">


<cfinput type="hidden" name="hiddenInput">

</cfform>


modal.html--------------------------------

<script type="text/javascript">

function GetPassedValue()
{
  var PassedString = window.dialogArguments;
  document.getElementById("OutString").innerText = PassedString;
 

}
function return_function(choice)
   {
   returnValue = choice;
   window.close();
   }
</script>

<html>
<body onload="GetPassedValue()">
 <span id="OutString"></span>.
<br>

<form name="test">
<input name="Choice" type="button" onClick="return_function(this.value);" value="View Form" > 
<input type="button" name="Choice" onClick="return_function(this.value);" value="Update Form">
<input type="button" name="Choice" onClick="return_function(this.value);" value="Delete Form">
</form>




</body>
</html>
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17125552
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

721 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