html input disabled not posted, why?
A form element if set to disabled, then the element value will not posted. This is a standard behaviour, Apart from form submission, disabled elements have following effects:
This example shows you how to set disabled property for INPUT
To overcome this problem either we can set a hidden input with same name and value or we can make this element as read-only like this one:
- Disabled elements will not receive focus
- Disabled elements are skipped in tab navigation
- Disabled elements will not be posted
This example shows you how to set disabled property for INPUT
<input name='sample' value='test' disabled>
To overcome this problem either we can set a hidden input with same name and value or we can make this element as read-only like this one:
<input name='sample' value='test' readonly>That's it. If you interested, just checkout disabled vs read only differences
Comments (0)