How to solve the problem of not getting form value after submitting html form input using disabled

How to solve the problem of not getting form value after submitting html form input using disabled

After the form input box input is set to the disable attribute and submitted, the value of the input box cannot be obtained. To solve this type of problem, you can refer to the following two methods:

Method 1:

Use readonly instead of disabled, that is,

disabled="disabled"

Modified to

readonly="readonly"

The difference between the two:

Disabled cannot receive focus and will be skipped when the tab key is used, which may not be successful;
Readonly can receive focus but cannot be modified. You can use the tab key to navigate, which may be successful.
Note: Only successful form elements are valid data, that is, values ​​can be obtained after submission. The value attribute of disabled and readonly text input boxes can only be modified through scripts.

Method 2:

Use type=hidden to hide the input to get the value, and then use disabled to show the input to the user.

<input type="hidden" name="url" value="http://www.neirong.org"/>
<input type="text" value="http://www.neirong.org" disabled="disabled"/>

Summarize

The above is the solution that I introduced to you when the HTML form input cannot obtain the form value after submitting it with disabled. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  Summary of JavaScript Timer Types

>>:  Details of the underlying data structure of MySQL indexes

Recommend

Complete Tutorial on Deploying Java Web Project on Linux Server

Most of this article refers to other tutorials on...

Detailed tutorial on how to quickly install Zookeeper in Docker

Docker Quickly Install Zookeeper I haven't us...

MySQL installation diagram summary

MySQL 5.5 installation and configuration method g...

Tutorial on resetting the root password of Mac MySQL

Disclaimer: This password reset method can direct...

Detailed explanation of Mysql's method of optimizing order by statement

In this article, we will learn about the optimiza...

Implementing license plate input function in WeChat applet

Table of contents Preface background Big guess Fi...

Detailed explanation of uniapp's global variable implementation

Preface This article summarizes some implementati...

Detailed explanation of nginx installation, deployment and usage on Linux

Table of contents 1. Download 2. Deployment 3. Ng...

Vue implements QR code scanning function (with style)

need: Use vue to realize QR code scanning; Plugin...

Detailed steps to start the Django project with nginx+uwsgi

When we develop a web project with Django, the te...

How to determine if the Linux system is installed on VMware

How to determine whether the current Linux system...

Linux kernel device driver kernel debugging technical notes collation

/****************** * Kernel debugging technology...