Solved

openModalDialog

Posted on 2006-07-06
7
1,465 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
Comment Utility
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
Comment Utility
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
Comment Utility
I'm getting servlet error 404
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:djb80
Comment Utility
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
Comment Utility
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
Comment Utility
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now