Is there any way of creating a combo box (<select>
) with a size of 1? All the examples I can find allow for multiple selects but with a number of options visible at any one time. If this cannot be accomplished with bog standard HTML is it possible in a JS library such as JQuery?
views:
440answers:
3
A:
EDIT: My post does not answer the question, but the comments might clarify the question.
What you want is to set the attribute size
to 1, i.e.:
<select size="1" name="...">
<option value="...">...</option>
...
</select>
Tom Bartel
2009-12-09 09:41:34
Hi Tom,It must allow for multiple items to be selected at once, not just one.
Thomas
2009-12-09 09:42:22
Ah, sorry. I don't know of any possibility to achieve this using standard HTML.
Tom Bartel
2009-12-09 09:44:24
Then you should set multiple="multiple" for <select> and height:xx i guess
Deniss Kozlovs
2009-12-09 09:44:26
My vision of such a thing would be perhaps a <select> that you click that drops down a whole bunch of items allowing you to click the ones you like with the menu "closing" when the user clicks elsewhere. Doesn't look to be possible does it? Sounds like I might need to look into creating a custom combo box although I'm not quite sure where to begin with that.
Thomas
2009-12-09 09:46:41
How about a list of checkboxes inside a div? You could have the div slide down when some event happens, and slide up again when you don't need it any more. If you think this could work for you, you could have a look at qtip (http://craigsworks.com/projects/qtip/).
Tom Bartel
2009-12-09 10:50:43
+1
A:
I'm afraid that would be usability nightmare. What is the more general goal you are trying to achieve? I'm sure better solutions already exist.
I could guess you need something like tag editor widget.
Andy Mikhaylenko
2009-12-09 10:01:13
A:
For the record, you can pass a size
parameter to a multiple select like this:
<?=$form->input('FieldName', array(
'size' => '5'
)); ?>
This is especially useful when you have long lists of HABTM related records.
Federico B.
2010-06-17 03:31:09