TheVeee
asked on
Make a drop down box read only
Trying to reuse a screen which contains a drop down selection box. I want to be able to make it be "Read Only". Reason why is want to use this screen for either adding or viewing only. Current code below, but you still can change the value. Any ideas?
Current code is:
<HTML>
<HEAD>
<TABLE>
<TR>
<TD width="179">PPD/COL:</TD>
<TD width="154">
<SELECT size="1" name="prepaidCollectCode">
<OPTION readOnly="true" value="">Select One</OPTION>
<OPTION readOnly="true" value='CC'
>
CC - Collect
</OPTION>
<OPTION readOnly="true" value='NC'
>
NC - Service Freight; No Charge
</OPTION>
<OPTION readOnly="true" value='PP'
>
PP - Prepaid (by Seller)
</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Current code is:
<HTML>
<HEAD>
<TABLE>
<TR>
<TD width="179">PPD/COL:</TD>
<TD width="154">
<SELECT size="1" name="prepaidCollectCode">
<OPTION readOnly="true" value="">Select One</OPTION>
<OPTION readOnly="true" value='CC'
>
CC - Collect
</OPTION>
<OPTION readOnly="true" value='NC'
>
NC - Service Freight; No Charge
</OPTION>
<OPTION readOnly="true" value='PP'
>
PP - Prepaid (by Seller)
</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ah, take the rest of those readonly="true" off there as well....
ASKER
Originally when I used disabled when I get to the activity, my code bombs because when I do a get Attribute is doesnt find the attribute. Thats why I switched to read only on input fields. Does this work different for drop downs??
on input fields it should be readonly="readonly"
on the select it is disabled="disabled"
nothing on the options themselves other than the one selected option which gets selected="selected"
on the select it is disabled="disabled"
nothing on the options themselves other than the one selected option which gets selected="selected"
Try the following code
<HTML>
<HEAD>
<TABLE>
<TR>
<TD width="179">PPD/COL:</TD>
<TD width="154">
<SELECT size="1" name="prepaidCollectCode" disabled=true>
<OPTION value="">Select One</OPTION>
<OPTION value='CC' >
CC - Collect
</OPTION>
<OPTION readOnly="true" value='NC' >
NC - Service Freight; No Charge
</OPTION>
<OPTION readOnly="true" value='PP' >
PP - Prepaid (by Seller)
</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TABLE>
<TR>
<TD width="179">PPD/COL:</TD>
<TD width="154">
<SELECT size="1" name="prepaidCollectCode" disabled=true>
<OPTION value="">Select One</OPTION>
<OPTION value='CC' >
CC - Collect
</OPTION>
<OPTION readOnly="true" value='NC' >
NC - Service Freight; No Charge
</OPTION>
<OPTION readOnly="true" value='PP' >
PP - Prepaid (by Seller)
</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
neonlines,
have you read any of the previous comments?
not only have you somewhat copied what was already posted, you copied it wrong as your code is not correct. please take the time to read the previous comments before posting.
bruno
have you read any of the previous comments?
not only have you somewhat copied what was already posted, you copied it wrong as your code is not correct. please take the time to read the previous comments before posting.
bruno
Bruno
Yes, I am sorry for my posting. I assumed something and I posted something
Sorry for my wrong intervention :(
Neonlines
Yes, I am sorry for my posting. I assumed something and I posted something
Sorry for my wrong intervention :(
Neonlines
neon,
no problem :-) looks like you just recently started answering questions here - just make sure to read what's already been posted so youdon't offend people. Other than that, good luck!
bruno
no problem :-) looks like you just recently started answering questions here - just make sure to read what's already been posted so youdon't offend people. Other than that, good luck!
bruno
bruno,
thankz for ur comments ;-)
thankz for ur comments ;-)
What happens when you do:
<select size="1" name="prepaidCollectCode" onchange="return false;">
Kind regards
-r-
<select size="1" name="prepaidCollectCode" onchange="return false;">
Kind regards
-r-
glad I could help TheVeee, thanks for the A! :-]