By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Make Multiple select box read only

AMT India
P: 64
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:177px;border:1px solid black;background:none;' name='Test[]' id='Test' size='10' multiple readonly>
[/html]

AMT
Apr 11 '08 #1
Share this Question
Share on Google+
6 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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
Apr 11 '08 #2

AutumnsDecay
100+
P: 170
If you mean something like a drop-down menu in form of a select box, that's easy.

Expand|Select|Wrap|Line Numbers
  1. <SELECT NAME="selectfieldname" SIZE=1>
  2.  
  3. <OPTION>Option1                        <OPTION>Option2
  4.                         <OPTION>Option3
  5.                         <OPTION>Option4
  6.                         <OPTION>Option5                        
  7. </SELECT>
  8.  
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.
Apr 13 '08 #3

AMT India
P: 64
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.
Apr 15 '08 #4

drhowarddrfine
Expert 5K+
P: 7,435
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.
Apr 15 '08 #5

P: 13
http://techeyes.blogspot.com/2007/11/making-html-select-readonly.html
Apr 15 '08 #6

acoder
Expert Mod 15k+
P: 16,027
http://techeyes.blogspot.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.
Apr 16 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.