Check checkbox, prevent user from unchecking

M

Mike Lopez

Hello.

I need to set a checkbox to the "checked" state and prevent the user from
unchecking it. I tried using "disabled", but then the value is not passed on
the Post to an ASP page.

Anyone have any ideas?

Thanks in advance,

Mike
 
R

Ray at

If the user cannot uncheck it, why does it exist? You can use disabled, but
then use a hidden input to carry through the value if you have to carry it
through. Depending on what you're doing, you may not have to carry it
through, because if your code knows that it should write the checkbox
disabled, you can make that same determination on the page that to which the
form posts.

Ray at work
 
M

Mike Lopez

Hi, Ray. Thanks for responding.

The checkbox(es) reflect surcharges that may or may not be automatically
checked, based on criteria. The user needs to know that a surcharge applies.
That's why it exists.

I was trying to avoid a hidden field because there are other checkboxes in
the same checkbox group that are not automatically checked. Maintaining the
value of the hidden field is a pain.

Making the same determination can be costly. I do it once, up front.

Any other thoughts?
 
R

Ray at

I see. I still suggest using hidden fields then, I'd say. If you name the
hidden field the same name as your checkboxes, it won't matter that it's not
a checkbox. Also, IIRC, the enabled=false (or is it disabled=true) isn't
totally cross-browser compatible. So, perhaps you'll want to display the
uncheckable items in a different way, like just in a bulleted list or
something.

Ray at work
 
R

Ray at

I was thinking that also, but checkboxes look different in different
browsers and they also look different in IE if the person is running XP with
the Candyland theme.

Ray at work
 
P

Paul

if you want to maintain a consistent view, maybe a gif of a checked box
rather than a check box?

regards
paul
 
P

Paul

ah. good point. I need to get out of the "I own the intranet and it's IE
only" frame of mind.

damn these dependencies

regards
paul
 
S

Scott

Ray Wrote:

"If the user cannot uncheck it, why does it exist?"

I asked the same question but then I thought about what
Ford does when you customize a vehicle on there Web-site.
They will disable a checkbox to keep you from selecting an
option that does go with the package you just chose.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top