473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Make Multiple select box read only

AMT India
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
6 14620
ronverdonk
4,258 Expert 4TB
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
170 100+
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
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
7,435 Expert 4TB
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
http://techeyes.blogspot.com/2007/11/making-html-select-readonly.html
Apr 15 '08 #6
acoder
16,027 Expert Mod 8TB
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

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

Similar topics

3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
1
by: merdaad | last post by:
I am trying to read multiple rows from an SP into a datalist. I can easily read and display multiple rows if I use a select statement but when I call an SP to send me a few rows, I only get back...
1
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
5
by: Sonnich | last post by:
Can anyone give me a quick hint for this? Say, I have: <SELECT NAME="opt3" SIZE="15" multiple> Then I'd like to list the items selected... echo $_POST; but this gives only the first one ...
1
by: dhyder | last post by:
OK, like the title says my error is Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. I have looked into this a lot, but have not...
2
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.