[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Trying to protect a checkbox using readonly - NOT WORKING!

Posted on 2004-11-22
Medium Priority
Last Modified: 2013-12-24
Below is a sample of my source.  I cannot figure out why the checkbox does not show up PROTECTED on my form.  Would appreciate any comments!

<cfset LockFld = "Y">
<cfif #LockFld# IS NOT "Y">
<INPUT TYPE="checkbox" name="Limits1" <cfif getPS1.Limits IS 1>Checked</cfif>>
<INPUT TYPE="checkbox" name="Limits1"  readonly <cfif getPS1.Limits IS 1>Checked</cfif>>
Question by:sulzener

Accepted Solution

bwasyliuk earned 500 total points
ID: 12645473
I have always used disabled instead of readonly - because of the following,...quote from (http://www.htmlcodetutorial.com/forms/_INPUT_DISABLED.html):

"It's important to understand that READONLY merely prevents the user from changing the value of the field, not from interacting with the field. For many types of fields, READONLY is irrelevent because you don't normally change the value. In checkboxes, for example, you can check them on or off (thus setting the CHECKED state) but you don't change the value of the field. DISABLED, however, actually prevents you from using the field."

If you want the "look" of a normal checkbox,...but the appearance of read only field (like a readonly text input) you can use a javascript function to undo the click when a user clicks a checkbox that you want to be read-only.

I can provide the code if required.


Expert Comment

ID: 12645494
as bwasyliuk pointed out above...what you are looking for is DISABLED and not READONLY


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Loops Section Overview
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question