Incorrect number of elements submitted by Form JS

Source: Internet
Author: User

See the following table:

 

 

<Form ID = "loginform" Action = "login. php? Act = signin "method =" Post "> <br/> <p id =" message "> </P> <br/> <p> <br/> <label = "username"> User Name: </label> <br/> <input type = "text" class = "login_input" id = "username" name = "username" size = "20"/> <br/> </P> <br/> <p> <br/> <label for = "password"> password: </label> <br/> <input type = "password" class = "login_input" id = "password" name = "password" size = "20"/> <br/> </P> <br/> <p> <br/> <label for = "code"> Verification Code: </label> <br/> <I Nput type = "text" name = "code" id = "code" class = "code" size = "5"/> <br/> <span> <br/> "/> <br/> </span> <br/> </P> <br/> <p id =" remember "> <br /> <input type = "checkbox" name = "remember" value = "1" id = "R"/> <br/> <label for = "R"> Save my login information this time. </Label> <br/> </P> <br/> <Div class = "login_bar"> <br/> <input type = "Submit" id = "act" class = "sub"/> <br/> </div> <br/> </form> 

Below is the JavaScript code used to verify the submission form:

 $ ("# Loginform "). submit (function () {<br/> var userid = $ ("# username "). val (), <br/> pwd =$ ("# password "). val (), <br/> code = $ ("# Code "). val (), <br/> result = true, <br/> message = $ ("# message"); <br/> act = $ ("# Act "). removeattr ("disabled", ""); <br/> If (userid. length = 0 | PWD. length = 0 | code. length = 0) <br/>{< br/> result = false; <br/> message. stop (false, true) <br/>. HTML ("All items are required! ") <Br/>. slidedown ("normal") <br/>. CSS ("background", "Red"); <br/> F = function () {<br/> message. slideup ("normal"); <br/>}< br/> T = setTimeout ("F ();", 5000); <br/> $ (this ). find ("input "). click (function () {f (); window. cleartimeout (t) ;}); <br/>}< br/> If (result) {act. addclass ("subload "). ATTR ("disabled", "disabled") ;}< br/> return result; <br/> }); 

PS: there is no problem with the company's computer. When I got home, I felt strange how I could not find the act in the post. No problem was found on the internet, and no problem was found on the form. It was confirmed repeatedly that the elements to be submitted in the form were added with name. By accident, I changed the above result method to direct return false/true; no problem.

PS2: The company is still not good, good guy, there is a way to only take signin behind the action.

This is strange. Why? Is it related to the environment? Remember this for the moment and update it later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.