forum

Home / DeveloperSection / Forums / Form gets submiited twice on button click

Form gets submiited twice on button click

Anonymous User175102-May-2013
Hi Mindstickians!

I have called below javascript function on

function formOnSubmit() {
    if (document.forms[0].ref_no.value == "") {

        if (document.forms[0].acc_code.value == "") {

            if (document.forms[0].vendor_code.value == "") {

                if (document.forms[0].acc_service_tax.value == "") {

                    if (document.forms[0].acc_doc_name.value == "") {
                        alert('Please enter atleast one attribute value');
                        return false;
                    }
                }
            }

        }
    } else {
        return true;
        document.forms[0].submit();

    }
}
where, ref_no,acc_code,vendor_code,acc_service_tax,acc_doc_name are textboxes

The problem is form gets submitted twice when I enter something in ref_no texbox and form submitss once for the rest of textboxes.

I want to know why form gets submitted twice when I enter ref_no value.

Thanks in advance! 


Updated on 02-May-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By