theflarenet theflarenet - 1 year ago 114
jQuery Question

Resume Form Submit after PreventDefault

I've looked around and found many similar answers but the form submit I have within my code fails. What seems to be missing or incorrect that prevents the form to submit when either 'submit' buttons are clicked and confirmed with SweetAlert?

<form id='submissionForm' autocomplete='off' method='POST'>
<input type='submit' name='submit' id='submitTest1' value='Submit 1'>
<input type='submit' name='submit' id='submitTest2' value='Submit 2'>

Clicking "Yes, I am sure" then "Ok" doesn't submit the form.

I've simplified the code:

Answer Source

The form element has a method named submit, but also has the form elements in the form as members.

If you have a button in the form named submit, you could access it using document.form1.submit. However, as that is the same name as the submit method, there is no longer any way of accessing that method. If you use the method to submit the form, that will no longer work.

Use this plunker:


<form id='submissionForm' autocomplete='off' method='POST'>

        <input type='submit' name='submit1' id='submitTest1' value='Submit 1'>
        <input type='submit' name='submit2' id='submitTest2' value='Submit 2'>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download