Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

openModalDialog

Posted on 2006-07-06
7
Medium Priority
?
1,480 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
6 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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-…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

824 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