readonly checkbox

Hi all
I'm just wondering if there is away to display a "readonly" checkbox??

Thanks in advance.
lina000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
You can try using disabled="disabled", don't think readonly="readonly" will do the trick.

With disabled-property however, the checkboxs value will also not be submitted along with the form, so when using that one, you should add a hidden textfield if you need a value to be submitted.

-r-
0
Pravin AsarPrincipal Systems EngineerCommented:
If you want user not to be able to uncheck the checkbox, you do always do following.

I am assuming, you want to inform user that her has selected certain option.


<p><input type="checkbox" value="1" onClick="this.checked=true;" checked >Check Box

This one set the box as checked always.

0
RainMan82Commented:
enabled = false
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Michel PlungjanIT ExpertCommented:
In what browser world do you have an attribute called enabled?

How about this, assuming you checked in on the server:

<input type="checkbox" onClick="this.checked=this.defaultChecked" <%= (isChecked)? " checked":"" %>>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mvan01Commented:
Here you go...

<html>
<head>
<title>mvan - Q_21772120 solution</title>

<script language="JavaScript">

function lockBox() {
  document.forms(0).name1.disabled=true;
  document.forms(0).name2.disabled=true;
}

</script>

</head>
<body onLoad="lockBox();">
<form>
<input type="checkbox" name=name1 value="1" checked >Static Check Box<br>
<input type="checkbox" name=name2 value="2" >Static Check Box<br>
<input type="checkbox" name=name3 value="3" >Active Check Box<br>
</form>
</body>
</html>

mvan
0
Michel PlungjanIT ExpertCommented:
document.forms is an array, not a collection

 document.forms[0]
0
mvan01Commented:
mplungjan,

Thank you.  

In IE, either worked: .forms(0) or .forms[0] .  MS let me get away with sloppy code, I guess.  : 0

I don't have FF on this computer, so I can't test it at this time.

mvan
0
lina000Author Commented:
Thanks all for replying!
The thing is that I need to display the checkbox not disabling it! because sometimes the user needs to print the form and in the same time I don't want him to check or uncheck the box so basically it will be used to displaying and later printing!!
0
mvan01Commented:
... so you needed the image of a checkbox (probably unchecked) that the user could not check on-line, so they could print it out (unchecked) and fill in the paper copy.  I guess the disabled checkbox did not do that for you, because it became greyed out?  Oh well...

mvan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.