Is it possible to POST/Submit an Input Checkbox that is disabled?

If coding is more your thing then the Website Development & Scripting forums are for you. Share server-side scripting and database integration tips, tricks and problems here.
Post Reply
Antoniorth
Newbie
Posts: 1
Joined: Thu Jan 23, 2020 3:53 pm

#1

Hello,

I have a checkbox that, given certain conditions, needs to be disabled. It turns out HTTP doesn't post disabled inputs. How can I get around that?


User avatar
worcester
Newbie
Posts: 3
Joined: Thu Sep 28, 2017 11:48 pm

#2

To get "readonly" look and POST checkbox's value at the same time, just add a hidden "input" with the same name and value as your checkbox. You have to keep it next to your checkbox or between the same <form></form> tags:

Code: Select all

<input type="checkbox" checked="checked" disabled="disabled" name="Tests" value="4">YOUR TEXT</input>

<input type="hidden" id="Tests" name="Tests" value="4" />
Also, just to let you know readonly="readonly", readonly="true", readonly="", or just READONLY will NOT solve this!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests