Questions about data submission

Source: Internet
Author: User
Must the data to be submitted be placed in the input or textarea labels? Isn't it possible to put it in another label? For example, why not use the span tag? What if it is inconvenient to use input or textarea? Must the data to be submitted be placed in the input or textarea labels? Isn't it possible to put it in another label? For example, why not use the span tag? What if it is inconvenient to use input or textarea?

Reply content:

Must the data to be submitted be placed in the input or textarea labels? Isn't it possible to put it in another label? For example, why not use the span tag? What if it is inconvenient to use input or textarea?

Yes. then you can use js to get the content of these labels, assemble them into the data to be submitted, and submit them to the backend through ajax.

A simple html form must be submitted, but if JavaScript is used for processing, you can simply put it as long as you can get the value through js ..

Form submission

How does a browser submit a form, or what does a browser do when submitting a form.

Instead of sending all the form controls to the server, the browser searches for all the successful controls and only sends the data of these successful controls to the server. what is a successful control?
To put it simply, the successful control means that each control in the form should have a name attribute and "current value". when submitting, they are used as part of the submitted data in the form of name = value.
In some special cases, the successful control also has the following rules:

  1. The control cannot be in the disabled status, that is, specify disabled = "disabled "]. That is, the disabled control is not a successful control.

  2. If a form contains multiple submission buttons, only the submitted button clicked by the user is a successful control.

  3. For the checkbox control, only checked by the user is a successful control.

  4. For a radio button, only the one selected by the user is a successful control.

  5. For the select control, all selected options are used as successful controls, and the name is provided by the select control.

  6. For the file upload control, if it contains the selected file, it will be a successful control.

In addition, the browser does not consider Reset buttons and OBJECT elements.

Note:

  1. For checkbox and radio buttons, if they are confirmed as successful controls but do not specify the value attribute for the controls, they will use "on" as their value when submitting a form.

  2. If you cannot read the value of a form control on the server, check whether it meets the preceding rules.

So,formTable ticket submission can only recognize the precedinghtmlType, other TypeformThe submission time is not submitted to the server.

Taken from Fish Li,

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.