| onSubmit not returning false! help please! |
dreamcatcher

msg:1483069 | 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; } else { return false; } } </script> |
| 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.
|
korkus2000

msg:1483070 | 6:02 pm on Jun 20, 2003 (gmt 0) | Try this as your onsubmit: onsubmit="return submitConfirmation();"
|
dreamcatcher

msg:1483071 | 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. :)
|
korkus2000

msg:1483072 | 6:37 pm on Jun 20, 2003 (gmt 0) | ;)
|
|
|