开发者

submision of disabled element in form

开发者 https://www.devze.com 2023-02-11 23:39 出处:网络
how can I submit disabled i开发者_C百科nputs in a form?You can\'t (at least no in anything approaching a sensible way). \"disabled\" means \"do not submit this control\"

how can I submit disabled i开发者_C百科nputs in a form?


You can't (at least no in anything approaching a sensible way). "disabled" means "do not submit this control"

Perhaps you mean "readonly" instead?


http://www.w3.org/TR/html4/interact/forms.html#h-17.12

By default you can't do this. You could store the value in a hidden input or something if you want to pass it with your form submission.


The only way you could submit a disabled input is use javascript to create a hidden input when something is switched to disabled and remove it when enabled.


If you feel like doing some JavaScript, you could have it enable your form elements when the user clicks submit.

document.getElementById("my-form-element").disabled=false

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号