473,396 Members | 1,864 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.

Is there any way to make a SELECT field in HTML as a read only field?

Hi, all

Is there any way to make a SELECT field in HTML as a read only field?

Jack
Jul 23 '05 #1
5 3101
Ivo
"datactrl" aka Jack asks
Is there any way to make a SELECT field in HTML as a read only field?


It is read-only by design, as far as i am aware. Perhaps you mean making it
impossible to alter the selected option(s). Then

<select onfocus="this.nextSibling.focus()">

works fine (if the next sibling is another form element).

<select onfocus="window.focus()">

makes the list flash open for a moment.
You realize that javascript will not available on many machines.
HTH
Ivo
Jul 23 '05 #2
Hi, Ivo
Thanks a lot. Yes, I mean making it impossible to alter the selected option.
I try the way you advised. It works the most times but sometimes the drop
list stays there insteead of flashing a moment. Do you have the same
problem? I use IE6.

Jack

"Ivo" <no@thank.you> wrote in message
news:40**********************@news.wanadoo.nl...
It is read-only by design, as far as i am aware. Perhaps you mean making it impossible to alter the selected option(s). Then

<select onfocus="this.nextSibling.focus()">

works fine (if the next sibling is another form element).

<select onfocus="window.focus()">

makes the list flash open for a moment.
You realize that javascript will not available on many machines.
HTH
Ivo

Jul 23 '05 #3
Yeah I noticed.
Ok try:
<select onChange="this.selectedIndex=0">
You can change the zero (which means the very first option) with a number
representing the index of the option that you want to keep selected EVEN if
the user attempts to select another one.
ps note that selectedIndex is CASE SENSITIVE: the i must be uppercase

ciao
Alberto
http://www.unitedscripters.com/

"datactrl" <qu***@tpg.com.au> ha scritto nel messaggio
news:40******@dnews.tpgi.com.au...
Hi, Ivo
Thanks a lot. Yes, I mean making it impossible to alter the selected option. I try the way you advised. It works the most times but sometimes the drop
list stays there insteead of flashing a moment. Do you have the same
problem? I use IE6.

Jack

Jul 23 '05 #4
It works on when the original Selected Value is fixed. But my problem is the
selected value comes from a database on server. Just can't change back to
the original unless the original has been saved.

Jack
"Alberto" <NO****@hotmail.com> wrote in message
news:c8**********@lacerta.tiscalinet.it...
Yeah I noticed.
Ok try:
<select onChange="this.selectedIndex=0">
You can change the zero (which means the very first option) with a number
representing the index of the option that you want to keep selected EVEN if the user attempts to select another one.
ps note that selectedIndex is CASE SENSITIVE: the i must be uppercase

ciao
Alberto
http://www.unitedscripters.com/

"datactrl" <qu***@tpg.com.au> ha scritto nel messaggio
news:40******@dnews.tpgi.com.au...
Hi, Ivo
Thanks a lot. Yes, I mean making it impossible to alter the selected

option.
I try the way you advised. It works the most times but sometimes the drop list stays there insteead of flashing a moment. Do you have the same
problem? I use IE6.

Jack


Jul 23 '05 #5
Arrange a default selected index. A select menu should have a defualt
selected index.
ciao
Alberto

"datactrl" <qu***@tpg.com.au> ha scritto nel messaggio
news:40********@dnews.tpgi.com.au...
It works on when the original Selected Value is fixed. But my problem is the selected value comes from a database on server. Just can't change back to
the original unless the original has been saved.

Jack
"Alberto" <NO****@hotmail.com> wrote in message
news:c8**********@lacerta.tiscalinet.it...
Yeah I noticed.
Ok try:
<select onChange="this.selectedIndex=0">
You can change the zero (which means the very first option) with a number
representing the index of the option that you want to keep selected EVEN

if
the user attempts to select another one.
ps note that selectedIndex is CASE SENSITIVE: the i must be uppercase

ciao
Alberto
http://www.unitedscripters.com/

"datactrl" <qu***@tpg.com.au> ha scritto nel messaggio
news:40******@dnews.tpgi.com.au...
Hi, Ivo
Thanks a lot. Yes, I mean making it impossible to alter the selected

option.
I try the way you advised. It works the most times but sometimes the

drop list stays there insteead of flashing a moment. Do you have the same
problem? I use IE6.

Jack



Jul 23 '05 #6

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

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
by: John Hall | last post by:
We need to read a SQL database containing a mix of English words and Chinese Characters. We think we need to use the N'xxxx' to read the Unicode. We have one place where the SELECT statement...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
3
by: yb | last post by:
I have a unbound mult-select listbox field named "Locations".Multi-select option is set to "Extended". I'm having problem saving the values from this field into table. I have text column...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
3
by: jej1216 | last post by:
I have a form in which a select field lists 5 items pus the option of "Other." I want a text field to be hidden unless the select field value is "Other." The form is HTML, but I am assuming that I...
1
by: bimeldip | last post by:
Hi, I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
0
by: bimeldip | last post by:
Hi, I have managed to create codes to display data from the database in a html page.I have gone on to create a page to allow users to manipulate the table via a html page. For instance users will be...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.