To summarize: Readonly is only valid for input (text / password) and textarea, while disabled is valid for all form elements, including select, radio, checkbox, button, etc. However, after using disabled for a form element, when we submit the form via POST or GET, the value of this element will not be passed out, while readonly will pass the value out (this situation occurs when we set the textarea element in a form to disabled or readonly, but the submit button can be used). The more common situations are: ① In a form, a unique identification code is pre-filled for the user, and the user is not allowed to change it. However, the value needs to be passed when submitting. In this case, its attribute should be set to readonly ② It is often encountered that after the user formally submits the form, he needs to wait for the administrator to verify the information. This does not allow the user to change the data in the form, but can only view it. Since disabled has a wide range of elements, disabled should be used at this time. However, it should be noted that the submit button should also be disabled. Otherwise, as long as the user presses this button, if no integrity check is performed on the database operation page, the value in the database will be cleared. If readonly is used instead of disabled in this case, it is still OK if there are only input (text/password) and textarea elements in the form. If there are other elements, such as select, the user can rewrite the value and press the Enter key to submit (Enter is the default submit trigger key) ③We often use JavaScript to disable the submit button after the user presses it. This can prevent the user from repeatedly clicking the submit button in an environment with poor network conditions, causing data to be redundantly stored in the database. |
<<: mysql8.0.23 msi installation super detailed tutorial
Nginx (engine x) is a lightweight, high-performan...
MySQL sets up independent writing separation. If ...
The installation of mysql-5.7.17 is introduced be...
Table of contents Class void pointing ES6 Arrow F...
Table of contents Props comparison of class compo...
Sometimes we may need to run some commands on a r...
Table of contents 1. WordPress deployment 1. Prep...
The following code introduces Chrome's monito...
As a tester, you may often need to install some s...
Note 1: Solve the problem of slow connection to M...
MySQL variables include system variables and syst...
Xhtml has many tags that are not commonly used but...
Today I will share with you a neon button animati...
Table of contents Preface Preliminary preparation...
Table of contents Tomcat Download Tutorial Tomcat...