Forum Moderators: open

Message Too Old, No Replies

multiple select problem

         

jackvull

1:37 pm on Aug 14, 2008 (gmt 0)

10+ Year Member



I created a multiple select box using the multiple tag.
Problem instead of being a listbox that you can click the down arrow to get it to open, it stays as one line.

Using size='5' is no good as it now a scroll bar drop down rather than something that opens fully and allows you to multi select.

How else do you do this?

penders

1:59 pm on Aug 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using size='5' is no good as it now a scroll bar drop down rather than something that opens fully and allows you to multi select.

Simply setting the size attribute to something > 1 should produce a fixed size list box of that many lines; not a drop down. However, it may depend on what browser you are using, as the W3C states [w3.org]:

size = number
If a SELECT element is presented as a scrolled list box, this attribute specifies the number of rows in the list that should be visible at the same time. Visual user agents are not required to present a SELECT element as a list box; they may use any other mechanism, such as a drop-down menu.

Although IE, FF and Opera should produce a fixed sized list box. Can you post a code fragment?

jackvull

3:01 pm on Aug 14, 2008 (gmt 0)

10+ Year Member




<td><b>Legal Entity:<i> Hold down CTRL to multi-select</i></b><br /><select id = 'LE' name = 'LE' style='width:200px;' multiple size='5'>
<option>--- Legal Entity ---</option>
<option value='0' selected>Select All</option>
<?
mssql_data_seek($resultLE,0);
while ($rowLE=mssql_fetch_assoc($resultLE))
{
echo "<option value='".$rowLE['CompanyCode']."'>(".$rowLE['CompanyCode'].") ".$rowLE['CompanyDescription']."</option>";
}
?>
</select></td>


<td><b>Legal Entity:<i> Hold down CTRL to multi-select</i></b><br /><select id = 'LE' name = 'LE' style='width:200px;' multiple size='5'>
<option>--- Legal Entity ---</option>
<option value='0' selected>Select All</option>
<option value='12'>(12) Comp Ltd</option>
<option value='20'>(20) Comp Consultancy Ltd</option>
<option value='44'>(44) Comp Structures</option>
<option value='45'>(45) A Ltd</option>
<option value='49'>(49) B Partnership</option>
<option value='73'>(73) Comp (CI) Ltd</option>
<option value='2002'>(2002) A Group (Malta) Ltd</option>
<option value='3051'>(3051) A NA Inc</option>
<option value='3151'>(3151) A Engineering Malaysia</option>
<option value='3152'>(3152) A </option>
<option value='3201'>(3201) A</option>
<option value='3251'>(3251) Project Management</option>
<option value='3271'>(3271) Korea</option></select></td>

penders

3:54 pm on Aug 14, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi jackvull, your code seems to work OK for me in FF2, IE6 and Opera9. The list box is fixed at 5 lines high (not a drop down), the 'Select All' option is selected initially and multiple options can be selected.

I'm not aware of any CSS that could effect this, or HTML for that matter. Do you have any JavaScript that might alter your SELECT element?

jackvull

11:31 am on Aug 15, 2008 (gmt 0)

10+ Year Member



Hi
The code works in that it puts a listbox up there but it is not a drop down.
I need it to be a drop down that the user can multiselect.
At the moment it is 5 rows in height with a scrollbar.
If I change it to size='1', it is a 1 row and you can only scroll through.
It used to be a drop down that appeared.

vincevincevince

11:35 am on Aug 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't have 'multiple' and a 'drop down' I'm afraid. You'll have to have multiple drop-down fields or a list-box type SELECT.