Make Multiple select box read only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AMT India
    New Member
    • Feb 2007
    • 64

    Make Multiple select box read only

    Hi,

    I have a multiple select box. By default all entries in that is selected. I want to make it as read only. I have tested with 'readonly' and 'readonly=true' both are not working. What I have to do? My code is as follows,

    [html]
    <select style='width:17 7px;border:1px solid black;backgroun d:none;' name='Test[]' id='Test' size='10' multiple readonly>
    [/html]

    AMT
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Do you mean that you have a multiple select box, i.e. a box where the user can select one or more items, and you don't want the user to select? Or what else do you mean by read-only? A user cannot change a select entry, just select (click) it. Please explain.

    Ronald

    Comment

    • AutumnsDecay
      New Member
      • Mar 2008
      • 170

      #3
      If you mean something like a drop-down menu in form of a select box, that's easy.

      Code:
      <SELECT NAME="selectfieldname" SIZE=1>
      
      <OPTION>Option1						<OPTION>Option2
      						<OPTION>Option3
      						<OPTION>Option4
      						<OPTION>Option5						
      </SELECT>
      The 'SELECT NAME=' part of the form is a way to name the field. This is mainly used for $_REQUESTS which are initiated by a server-side script.

      The 'SIZE=' part indicates how many options to show at a time. The web-industry standard is '1', because if multiple options were able to shown at once, there would be no reason to even have a select field.

      Each '<OPTION>' is a user-selectable option that will be referenced by the select field when the form is submited. In essence, the <OPTION> parts of the form are similar to that of a "Value=" attribute of a button.

      Hope this helps.

      Comment

      • AMT India
        New Member
        • Feb 2007
        • 64

        #4
        Originally posted by ronverdonk
        Do you mean that you have a multiple select box, i.e. a box where the user can select one or more items, and you don't want the user to select? Or what else do you mean by read-only? A user cannot change a select entry, just select (click) it. Please explain.

        Ronald
        Yes, I mean that my multi select box has a number of entries. By default all options are selected. I want to make it as read only, so that after clicking on these items nothing should happen. All the items should be in the selected format.

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          Whenever you get into behavior, you leave the realm of html and css. This can only be accomplished with javascript or the server side. I'm sending this to the js board.

          Comment

          • mmurph211
            New Member
            • Jan 2008
            • 13

            #6
            http://techeyes.blogsp ot.com/2007/11/making-html-select-readonly.html

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Originally posted by mmurph211
              http://techeyes.blogsp ot.com/2007/11/making-html-select-readonly.html
              That would only work with a single select, not a multiple one.

              For a multiple select, the easy solution is to disable it and then enable when submitting.

              Comment

              Working...