...

View Full Version : checkboxes and readonly



alex57
01-13-2007, 08:02 PM
Hello,

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.

thanks

david_kw
01-13-2007, 08: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);" />

david_kw

alex57
01-13-2007, 10: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??

david_kw
01-13-2007, 10: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?

david_kw

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum