472,982 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

readOnly attribute doesn't work for drop down list?

I want to know if readOnly attribute doesn't work for drop down list?
If I try disabled attribute, it works fine for drop down list. When I
try text box, it works fine for both disabled and readOnly attribute.

For example, #1 will work, but #2 doesn't work

1) <SELECT name="streetDirection" class="FormInput" DISABLED>
In JavaScript, I have InputForm.streetDirection.disabled = false;

2) <SELECT name="streetDirection" class="FormInput" readOnly>
In JavaScript, I have InputForm.streetDirection.readOnly= false;

any ideas? thanks!!
Jul 23 '05 #1
3 25274
Matt wrote:
I want to know if readOnly attribute doesn't work for drop down list?
If I try disabled attribute, it works fine for drop down list. When I
try text box, it works fine for both disabled and readOnly attribute.

For example, #1 will work, but #2 doesn't work

1) <SELECT name="streetDirection" class="FormInput" DISABLED>
In JavaScript, I have InputForm.streetDirection.disabled = false;

2) <SELECT name="streetDirection" class="FormInput" readOnly>
In JavaScript, I have InputForm.streetDirection.readOnly= false;

any ideas? thanks!!

"Select" is always read only.
Mick
Jul 23 '05 #2


Matt wrote:
I want to know if readOnly attribute doesn't work for drop down list?
2) <SELECT name="streetDirection" class="FormInput" readOnly>
In JavaScript, I have InputForm.streetDirection.readOnly= false;


According to
http://www.w3.org/TR/html4/interact/forms.html#h-17.6
there is no readonly attribute defined for <select> elements thus there
can't be a property for HTMLSelectElement objects:
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-94282980

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3
Matt wrote:
I want to know if readOnly attribute doesn't work for drop down list?
If I try disabled attribute, it works fine for drop down list. When I
try text box, it works fine for both disabled and readOnly attribute.

For example, #1 will work, but #2 doesn't work

1) <SELECT name="streetDirection" class="FormInput" DISABLED>
In JavaScript, I have InputForm.streetDirection.disabled = false;

2) <SELECT name="streetDirection" class="FormInput" readOnly>
In JavaScript, I have InputForm.streetDirection.readOnly= false;

any ideas? thanks!!


The readonly attribute appears to not be supported on <select> elements
by Firefox 0.9, IE6SP1 or Opera 7.51.

<url:
http://msdn.microsoft.com/workshop/a...cts/select.asp
/> confirms this by not listing "readonly/readOnly" as a valid property
on the <select> object.

<url: http://www.w3.org/TR/html401/interac...html#h-17.12.2 /> also
seems to confirm this behavior: "The following elements support the
readonly attribute: INPUT and TEXTAREA."

That spec doesn't specifically exclude SELECT, but it doesn't include it
either, and the fact that none of the 3 user agents I tested support
readonly on <select> points to user agents adhering to the letter of the
spec.

In other words, what you are seeing is documented behavior.

Besides, what would be the point of a readonly <select>? It would appear
to be a normal <select>, but it wouldn't open as a normal <select> does,
which would be very confusing for the user.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #4

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

Similar topics

2
by: Darshak Shah | last post by:
Hi, * Question background : My DB is in ArchiveLog mode. I have TS in ReadOnly mode. As i know, - Oracle allows to DROP table resides in ReadOnly TS (& other objects also) even though that...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
3
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
7
by: Jimbo | last post by:
Hi, I am trying to set the readonly attribute of a text input tag dynamically from javascript. The input element already exists in the form and I want to make it readonly when a particular...
8
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
6
by: Johnny Jörgensen | last post by:
I've got a usercontrol derived from a normal ComboBox that contains some special formatting code. On my main form I've got a lot of my custom comboboxes. I discovered a bug in the derived...
3
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.