I have some disabled inputs in my form and I want to send them to the server, but Chrome excludes them from the request.
Is there a way to solve this problem without adding hidden fields?
<form action="/Media/Add"> <input type="hidden" name="Id" value="123" /> <!-- this does not appear in request --> <input type="textbox" name="Percentage" value="100" disabled="disabled" /> </form>
Use Jquery and send data using ajax, you can solve your problem:
Elements with the
disabled
attribute are not submitted, or you can say that their values are not posted (see HTML 5 Specification for Building Form Datasets).Right now,
FYI, as per 17.12.1 In the HTML 4 specification:
You can use the
readonly
attribute in your case, by doing this you will be able to post the data of the field.Right now,
For reference only, according to 17.12.2 In the HTML 4 specification: