Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

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>
0
TheVeee
Asked:
TheVeee
1 Solution
 
brunoCommented:
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
 
brunoCommented:
ah, take the rest of those readonly="true" off there as well....
0
 
TheVeeeAuthor Commented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
brunoCommented:
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
 
neonlinesProject managerCommented:
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
 
brunoCommented:
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
 
neonlinesProject managerCommented:
Bruno

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

Sorry for my wrong intervention :(

Neonlines
0
 
brunoCommented:
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
 
neonlinesProject managerCommented:
bruno,

thankz for ur comments ;-)

0
 
RoonaanCommented:
What happens when you do:

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

Kind regards

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now