homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

onSubmit not returning false!
help please!

 5:59 pm on Jun 20, 2003 (gmt 0)

I`m coding a guestbook and I want a message to appear when someone clicks "Delete" to say something like "Are you Sure?", then ok returns true, cancel returns false.

The code, which someone here gave me (can`t remember who) is as follows:

<script language="JavaScript" type="text/JavaScript">

function submitConfirmation()


var confirmSub = confirm("Are you sure?");
if (confirmSub)


return true;




return false;




Then I use the onsubmit = submitConfirmation(); in the form tag.

The code is displaying ok, in the sense that the box appears ok, saying "Are you sure?", but its not returning false if cancel is clicked. The entry gets deleted if ok or cancel are clicked.

Any ideas please?

Thank you.



 6:02 pm on Jun 20, 2003 (gmt 0)

Try this as your onsubmit:

onsubmit="return submitConfirmation();"


 6:37 pm on Jun 20, 2003 (gmt 0)

Thanks Korkus2000. I think you might have been the one who gave me the code originally.

Anyway, yep, that works fine. Thanks.



 6:37 pm on Jun 20, 2003 (gmt 0)


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved