?
Solved

Make a drop down box read only

Posted on 2005-03-14
11
Medium Priority
?
266 Views
Last Modified: 2008-03-10
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>
0
Comment
Question by:TheVeee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 18

Accepted Solution

by:
bruno earned 500 total points
ID: 13535551
here you go:



<html>
<head>
    <table>
        <tr>
            <td width="179">    PPD/COL:
            </td>
            <td width="154">
                <select size="1" name="prepaidCollectCode" disabled="disabled">
                    <option readonly="true" value="">Select One</option>
                    <option readonly="true" value='CC'>CC&nbsp;-&nbsp;Collect</option>
                    <option value='NC'>NC&nbsp;-&nbsp;Service Freight; No Charge</option>
                    <option selected="selected" value='PP'>PP&nbsp;-&nbsp;Prepaid (by Seller)</option>
                </select>
            </td>
        </tr>
    </table>
</body>
</html>
0
 
LVL 18

Expert Comment

by:bruno
ID: 13535556
ah, take the rest of those readonly="true" off there as well....
0
 
LVL 5

Author Comment

by:TheVeee
ID: 13535735
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??
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
LVL 18

Expert Comment

by:bruno
ID: 13536040
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"
0
 
LVL 3

Expert Comment

by:neonlines
ID: 13536118
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>
0
 
LVL 18

Expert Comment

by:bruno
ID: 13536258
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
0
 
LVL 3

Expert Comment

by:neonlines
ID: 13537171
Bruno

Yes, I am sorry for my posting. I assumed something and I posted something

Sorry for my wrong intervention :(

Neonlines
0
 
LVL 18

Expert Comment

by:bruno
ID: 13537691
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
0
 
LVL 3

Expert Comment

by:neonlines
ID: 13537729
bruno,

thankz for ur comments ;-)

0
 
LVL 49

Expert Comment

by:Roonaan
ID: 13537812
What happens when you do:

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

Kind regards

-r-
0
 
LVL 18

Expert Comment

by:bruno
ID: 13538077
glad I could help TheVeee, thanks for the A!  :-]
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question