473,396 Members | 1,975 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,396 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 25293
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.