Page 1 of 1

Confirm Form Submission

Posted: Fri Aug 11, 2006 7:32 am
by jamiel
Hi All,

Having some problems getting Javascript to use the Action I specified for my form in my HTML when using the following function.

Code: Select all

function confirm_submit(form, msg)
{
        response = confirm(msg);
        if (response == false) {
                return false;
        } else {
                form.submit();
                return true;
        }
}
If I use onSubmit="return confirm_submit(this, 'my message')" , if I choose No it does as expected, but if I select Yes, it submit's the form but ignore's the action I have specified in my form.

Any ideas?

Posted: Fri Aug 11, 2006 8:11 am
by Weirdan
hmm... why not use simple onsubmit='return confirm("message here");' ?