Today I created an HTML form, one of which is sequence number, which is automatically generated asynchronously from the background using AJAX, and I don't want the user to modify the value, so I use the following HTML code to handle it:
<path= "SequenceNumber" ID= "sequencenumber" Disabled= "true"/>
Now that's the problem, my form submits to the spring MVC controller to discover that the SequenceNumber field of the Dto Pojo is empty. I used the following HTML code to try my luck when I was baffled:
<path= "SequenceNumber" ID= "sequencenumber" ReadOnly= "true"/>
Did not expect this entity class SequenceNumber has the value, in order to identify the cause of the problem, above the w3cschool above the brain complements the two attributes of the difference:
The Disabled property specifies that the input element should be disabled. The disabled INPUT element is neither available nor clickable.
The ReadOnly property specifies that the input field is read-only. A read-only field cannot be modified.
Obviously, one is disabled, the other is read-only, and the difference is quite large.
The difference between HTML readonly and disabled