Link to home
Start Free TrialLog in
Avatar of TheVeee
TheVeeeFlag for United States of America

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&nbsp;-&nbsp;Collect
                              </OPTION>
                        
                        <OPTION readOnly="true"  value='NC'  
                                    
                              >
                              NC&nbsp;-&nbsp;Service Freight; No Charge
                              </OPTION>
                        
                        <OPTION readOnly="true"  value='PP'  
                                    
                              >
                              PP&nbsp;-&nbsp;Prepaid (by Seller)
                              </OPTION>
                        
                        </SELECT>
                  </TD>
                  </TR>
            </TABLE>
      </BODY>
</HTML>
ASKER CERTIFIED SOLUTION
Avatar of bruno
bruno
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ah, take the rest of those readonly="true" off there as well....
Avatar of TheVeee

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"
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&nbsp;-&nbsp;Collect
                         </OPTION>
                   
                    <OPTION readOnly="true"  value='NC'  >
                         NC&nbsp;-&nbsp;Service Freight; No Charge
                         </OPTION>
                   
                    <OPTION readOnly="true"  value='PP'  >
                         PP&nbsp;-&nbsp;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
Bruno

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
bruno,

thankz for ur comments ;-)

Avatar of Roonaan
What happens when you do:

<select size="1" name="prepaidCollectCode" onchange="return false;">

Kind regards

-r-
glad I could help TheVeee, thanks for the A!  :-]