Solved

openModalDialog

Posted on 2006-07-06
7
1,470 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

948 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

21 Experts available now in Live!

Get 1:1 Help Now