Author |
Message |
Barcode
Joined: 02 Jun 2005 Posts: 16 Location: New York, NY
|
Posted: Mon Jun 27, 2005 - 9:40 pm Post subject: <select> displaying extra row... |
|
|
I am trying to get a <select> box that displays all three choices. I don't want the user to select multiple items. But I want them to see all three choices available to them.
Code: | <select id='ctrChoice' onchange='changeChoice ( this );' size=3>
<option value=-1>Choice-1</option>
<option value=0 selected>Choice0</option>
<option value=1>Choice1</option>
</select> |
The problem is that whenever this is displayed in a widget it shows a fourth row at the end. Is there some way I can force the <select> box to only show the three items and not the empty fourth row?
Thanks! |
|
|
|
|
gnome Administrator

Joined: 26 Sep 2004 Posts: 145
|
Posted: Tue Jun 28, 2005 - 9:34 am Post subject: |
|
|
<select id="ctrChoice" onchange="changeChoice ( this );" size="3" style="height: 4em;">
<option value=-1>Choice-1</option>
<option value=0 selected>Choice0</option>
<option value=1>Choice1</option>
</select> |
|
|
|
|
cerberus
Joined: 20 Jun 2005 Posts: 118
|
Posted: Fri Jul 15, 2005 - 3:09 pm Post subject: |
|
|
I am curious why you are starting at "option -1" instead of 0... I have used the select tag for menus ( like the Apple "Voices" widget) and I start at option 0.. What happens when you start with -1 ?
cerberus |
|
|
|
|
Chris
Joined: 27 Jan 2005 Posts: 344 Location: Durham, UK
|
Posted: Fri Jul 15, 2005 - 5:00 pm Post subject: |
|
|
cerberus wrote: | I am curious why you are starting at "option -1" instead of 0... I have used the select tag for menus ( like the Apple "Voices" widget) and I start at option 0.. What happens when you start with -1 ?
cerberus |
Huh? You can put anything you like in the value attribute - admittedly he should be enclosing the attribute's value with speech marks. When iterating through the options collection of the <select> then they do start at zero, but that's not relevant to what he's doing there. It might be, for example, for speaker balance, where you have -1 as the left, 0 as the middle and 1 as the right... |
|
|
|
|
cerberus
Joined: 20 Jun 2005 Posts: 118
|
Posted: Fri Jul 15, 2005 - 8:26 pm Post subject: |
|
|
Chris wrote: | cerberus wrote: | I am curious why you are starting at "option -1" instead of 0... I have used the select tag for menus ( like the Apple "Voices" widget) and I start at option 0.. What happens when you start with -1 ?
cerberus |
Huh? You can put anything you like in the value attribute - admittedly he should be enclosing the attribute's value with speech marks. When iterating through the options collection of the <select> then they do start at zero, but that's not relevant to what he's doing there. It might be, for example, for speaker balance, where you have -1 as the left, 0 as the middle and 1 as the right... |
Oh cool.. Can you also make an array size start at a negative number so the default "item 0" can be any item in the array without needing to re-order the array ?
cerberus |
|
|
|
|