tags:

views:

34

answers:

2

Is it possible to have a selectbox that has a default option such as: "Select One" but have the term "Select One" not present in the actual list itself?

 <select name="test" id="test">
 <option value="" selected="selected">Select A Entry</option>
 <optgroup label="A Label">
 <option value="one">Option 1</option>
 <option value="two">Option 2</option>
 <option value="three">Option 3</option>
 </optgroup>

    </select>
A: 

I would go so far as to say no. Personally I would leave it in this list but write a javascript function to validate user input on form submission.

Kieran
A: 

You could use this little bit of Javascript to do the trick:

<select name="test" id="test" onclick="this.remove(0);this.onclick=''">

As they click the list to select an option, it removes the first option ("Select an Entry" from the list, then clears the event handler so it only does this the first time.

Nick