[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Why Stack Overflow with Confirm Box

Posted on 2003-11-24
6
Medium Priority
?
249 Views
Last Modified: 2012-05-04
I got stack overflow error when I implement a confirm box.  I don't know how to fix it.  Here is my code:

function confirm() {
  if(confirm('Are you sure to continue?')){
    document.forms[0].submit();
  }
  else{
    return false;
  }
}

<form name="form1" method="Post" action="create_inspection.jsp" onsubmit="return validate()">

<input type="Button" name="Submit" value="Enter Inspection" onClick="confirm()">
</form>

This form and javascript is in jsp create_inspection.jsp.  If user confirm the action, the request will be sent to the same page for database insert; otherwise, user stay with the page without submitting the form.

If I get rid of the confirm, everything is good. But if I add the confirm box, I got the stack overflow error.

0
Comment
Question by:qding
[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
  • 2
  • 2
6 Comments
 
LVL 10

Accepted Solution

by:
NetGroove earned 200 total points
ID: 9814241
You did overwritten the confirm() method with your function.
Cahnge it to this:

function doConfirm() {
  if(confirm('Are you sure to continue?')){
   document.forms[0].submit();
 }
 else{
   return false;
 }
}

<form name="form1" method="Post" action="create_inspection.jsp" onsubmit="return validate()">

<input type="Button" name="Submit" value="Enter Inspection" onClick="doConfirm()">
</form>


0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 9814244
try changing the your function name to something else other than confirm(), such as
function submitConfirm()
{......}
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 9814251
almost posted at exact same time   :-)
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9816300
Hello qding,

do you confirm that upper comments solved your problem?
Or do you have also work overflow :)
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10383653
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: NetGroove {http:#9814241}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

650 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