473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Disable checkbox

I have a checkbox that I set by php code to be either "checked" or "".
I want to disable the ability of the user to check or uncheck it. I
tried "readonly", but that didn't work. Any suggestions?

Feb 16 '06 #1
7 12467

sheldo...@gmail.com wrote:
I have a checkbox that I set by php code to be either "checked" or "".
I want to disable the ability of the user to check or uncheck it. I
tried "readonly", but that didn't work. Any suggestions?


<http://www.google.com/search?q=disable+checkbox>

Try the first link that comes up.

Feb 16 '06 #2
I think it is disabled="true" that you want to use. That should work, I
think.

Feb 16 '06 #3

Michael wrote:
I think it is disabled="true" that you want to use. That should work, I
think.


HTML style:
<input type="checkbox" name="foo" disabled>

XHTML style:
<input type="checkbox" name="foo" disabled="disabled"/>

Feb 16 '06 #4

"ZeldorBlat" <ze********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Michael wrote:
I think it is disabled="true" that you want to use. That should work, I
think.


HTML style:
<input type="checkbox" name="foo" disabled>

XHTML style:
<input type="checkbox" name="foo" disabled="disabled"/>


The "disabled" worked. What is that trailing slash for?
Feb 17 '06 #5

Shelly wrote:
"ZeldorBlat" <ze********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
HTML style:
<input type="checkbox" name="foo" disabled>

XHTML style:
<input type="checkbox" name="foo" disabled="disabled"/>


The "disabled" worked. What is that trailing slash for?


XHTML compliance. In XHTML, all tags must have matching closing tags.
Some tags are "self-closing" however (like <input>) so instead of a
</input> you just leave a trailing / to close it.

Feb 17 '06 #6
ZeldorBlat schrieb:
Michael wrote:
I think it is disabled="true" that you want to use. That should work, I
think.

HTML style:
<input type="checkbox" name="foo" disabled>

XHTML style:
<input type="checkbox" name="foo" disabled="disabled"/>


Disabled and readonly are different things - IIRC the values of readonly
elements are submitted while the values of disabled elements are not. So
the OP could run into problems in the case of:

<input type="checkbox" name="foo" value="1" checked disabled>

In this case readonly is definitely the correct attribute. Internet
Explorer seems not to support readonly, though, which is a bug.

Anyway as this is not a PHP topic there might more detailed information
to be found in an HTML group.

--
Markus
Feb 17 '06 #7
In my case it is "disabled". The reason is that I want to show which
uploads have been done as indicated by the presence of the file on the
server. I dynamically put in "disabled" or leave it blank. If it is
disabled, I set it as checked. I do this by checking for the presence
of the files on the server and setting session variables if they are
there. In other words, the check box is not a "choice". Rather, it is
an indicator of completion.

When the user does the submit for the entire transaction, I first check
to see if all the required uploads are present (not all are required),
and then process the information. (All that is done is PHP). If they
are not all there, I present the user with information about the what
is missing.

When he uploads the missing file, the checkbox is set as checked and
disabled.

Shelly

Feb 17 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vikram | last post by:
How to disble a particular checkbox list item in a checkbox list
4
by: Matrixreloadedth | last post by:
How to change disable color of Checkbox??? I have a checkbox with forecolor in red but when i disable by set Enable properties to false forecolor is changed to gray color but i don't want it. how...
3
by: James Lennon | last post by:
Does anyone know how to disable a single check box in a Windows Forms TreeView control.
0
by: Li Pang | last post by:
Hi, I want to know how to disable some of checkbox in a listview programatically. thanks
2
by: madhusudanreddy | last post by:
hi iam new to scripts, i have a dropdownlist and ckeckbox ,i want to disable the ckeckbox when the user selects the second option of dropdownlist .how to do this please help me..........?
6
by: feninazman | last post by:
hi ;) i'm doing my intern now.this is my 1st time using ASP.NET web matrix with VB.NET language... i need help in disabling my checkboxes. i have 4 checkboxes, let say "air" "water" "ice" "snow"...
1
by: rash007 | last post by:
I am building up a table in php built from an array in a database. I can assign each row its own id's etc. But I need to enable or disable checkbox buttons and a text area depending on the checkbox...
2
by: tvnaidu | last post by:
How can I disable checkbox when it is selected Kernel?. <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td align="right" width="40%" valign="top"...
5
by: gina farrow | last post by:
I have form that needs to be checked by four people. I need to show the check marks on the form and once they have checked the box they cant change it.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.