Solved

Confirm

Posted on 2006-07-12
1
564 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
1 Comment
 
LVL 19

Accepted Solution

by:
dakyd earned 500 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

762 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

8 Experts available now in Live!

Get 1:1 Help Now