Cause of the error that form. submit () cannot be submitted: form. submit form
Source: http://www.ido321.com/948.html
Directly Add the following code:
1: <div id="register">
2:
3: <div class="formdiv">
4: <form method="post" action="register.php?action=register" name="register" id="registerForm">
5: <dl>
6: <dt> enter the following content carefully </dt>
7: <dd class="hasspan">
8: User name: <input type = "text" name = "username">
9: </dd>
10: <dd class="hasspan">
11: password: <input type = "password" name = "pwd">
12: </dd>
13: <dd class="hasspan">
14. Confirm the password: <input type = "password" name = "pwdagain">
15: </dd>
16: <dd id="tximg">
17:
18: <input type="hidden" name="touxiang" value="">
19: <label id="imgsrclabel">m01.gif</label>
20: </dd>
21: <dd style="margin-right:120px;">
22: Verification code: <input type = "text" name = "code">
23: <span>
24:
25: <a href = "# code" id = "change"> change one </a>
26: </span>
27: </dd>
28: <dd class="btns">
29: <input type = "button" name = "submit" id = "submit" value = "register">
30: <input type = "button" name = "quit" id = "quit" value = "quit">
31: </dd>
32: </dl>
33: </form>
34: </div>
35: </div>
The form data is submitted to this page. The following is js processing.
1:/* submit a registry ticket */
2: function formDeal()
3: {
4: var btnSubmit = document.getElementById('submit');
5: var formId = document.getElementById('registerForm');
6: btnSubmit.onclick = function()
7: {
8: // The submit () method of the form cannot submit the form.
9: formId.submit();
10: }
11:
12: }
If the form is submitted, a message is displayed on this page.
1: if(!empty($_GET['action']) && $_GET['action'] == 'register')
2: {
3: echo 'you submitted data ';
4: exit();
5: }
After testing for a long time, I didn't see any prompts. I thought the code was wrong or the method was wrong. I checked carefully and confirmed that there was no error in the Results official document.
FormId. submit () cannot be submitted, so we have to change the type of btnSubmit to submit.
1: this.type="submit"
I checked the information online for two reasons:
1. The form cannot contain the name = "submit" label.
2. The form cannot contain "enctype =" multipart/form-data"
After testing, these two points are ridiculous and have not solved my problem (maybe my problem environment is different)
Later, I thought the Forum friends suggested that I change the Registration button ID to a name without submit. After correction, the form is submitted normally and the prompt message appears.
Conclusion: do not set the button id to submit. Otherwise, confusion may occur. As a result, the submit () method of the form cannot submit the form. When naming an ID, it is recommended that the name be unique with the existing api to avoid unnecessary troubles.
Next article: depth: Why is lanxiang so popular?
Formsubmit cannot be submitted
I'm not familiar with the vecolity template, but I need to submit a method, post or get in the background. Check if flag is true.
JS onmousedown = "javascript: documentformsubmit ()" form submission Problem
Whether the form contains the name attribute in <form name = "form">. If not, add