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
Preface Recently, I have been busy dealing with s...
【1】Know the width and height of the centered elem...
Table of contents Introduction Step 1 Step 2: Cre...
Ⅰ. Problem description: Use html+css to implement...
To create a flex container, simply add a display:...
Kernel: [root@opop ~]# cat /etc/centos-release Ce...
Recently, an error occurred while starting MySQL....
Often, we may need to export local database data ...
1. Four startup methods: 1.mysqld Start mysql ser...
Preface Today I installed MySQL and found that th...
First you need to install Vue-cli: npm install -g...
Next, we will learn how to monitor server perform...
1. Insert the wireless network card and use the c...
Preface MySQL is the most popular relational data...
Introduction to the polling algorithm Many people...