Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Is there any way to make a SELECT field in HTML as a read only field?

Reply
Thread Tools

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

 
 
datactrl
Guest
Posts: n/a
 
      05-19-2004
Hi, all

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

Jack


 
Reply With Quote
 
 
 
 
Ivo
Guest
Posts: n/a
 
      05-19-2004
"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


 
Reply With Quote
 
 
 
 
datactrl
Guest
Posts: n/a
 
      05-20-2004
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" <(E-Mail Removed)> wrote in message
news:40aba129$0$89222$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Alberto
Guest
Posts: n/a
 
      05-20-2004
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" <(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
datactrl
Guest
Posts: n/a
 
      05-20-2004
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" <(E-Mail Removed)> wrote in message
news:c8gut3$34s$(E-Mail Removed)...
> 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" <(E-Mail Removed)> ha scritto nel messaggio
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any way to make the VS 2005 HTML designer show something approx to what I ask for Lloyd Sheen ASP .Net 3 03-18-2008 04:38 PM
how to make programmatically a field of detailsview read-only ? Cas ASP .Net 0 10-21-2006 04:08 PM
how to make programmatically a field of detailsview read-only ? Cas ASP .Net Web Controls 0 10-21-2006 04:08 PM
how to make programmatically a field of detailsview read-only ? Cas ASP .Net Datagrid Control 0 10-21-2006 04:08 PM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM



Advertisments