View Full Version : checkboxes and readonly

01-13-2007, 09:02 PM

I need a checkbox to appear that doesnt allow the user to check it and uncheck it but still passes the value across.

Using the disabled attribute means the user cannot check and uncheck but the value doesnt pass across, and using the readonly attribute passes the value across but the user can still check and uncheck it.

Can anyone provide an attribute to the checkbox element that solves my problem.


01-13-2007, 09:29 PM
From what I read, if a checkbox input is set to readonly you can click to change the check but it doesn't change the value. So I would do it this way.

<input type="checkbox" readonly="readonly" onclick="return(false);" />


01-13-2007, 11:12 PM
Is there not a way to get it exactly how I like that is set the value and leave it unchangeable to the user??

01-13-2007, 11:54 PM
That way didn't work for you? How exactly do you want to set it? From html? From javascript?

What was wrong with that example. Did it allow you to change the value?


01-14-2007, 01:02 PM
Oops yeh my mistake, works like a charm. Thanks !!