?
Solved

Confirm

Posted on 2006-07-12
1
Medium Priority
?
572 Views
Last Modified: 2008-02-01
I would like this to submit the page on if ok and
stay on the page if cancel

There are two pages

Here is page one
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;
 
  if (confirm("Are you sure you want to " + ReturnedValue))
          return true;
     else
          return false;
 
 
}

</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>



Here is the second page:
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
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
1 Comment
 
LVL 19

Accepted Solution

by:
dakyd earned 2000 total points
ID: 17093320
I don't use CF, so I'm not too familiar with <cfform>, but if it works the same way as the plain old HTML form, then this should work:

<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;
 
  if (confirm("Are you sure you want to " + ReturnedValue))
          return true;
     else
          return false;
 
 
}

</script>

<cfform action="test_index.cfm" name = "ask">
<cfinput type="radio" value=" Open Modal Dialog" name = "hello" onclick="if (OpenModalDialog()) document.ask.submit();"/>CHOOSE
<cfset bring_this = "bring_this">
<cfinput type="hidden" name="hiddenInput">
</cfform>
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
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…
Suggested Courses

741 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