Forum Moderators: open
I have several options available for selection within a form, but I would like an explanatory piece of text "Please select" to be the default text visible (though not selectable). I'm not sure how to achieve this. Can anyone please help ?
Many thanks
My code so far:-
<select name="treatment" size="1" >
<option value="service1" selected="selected">service1</option>
<option value="service2">service2</option>
<option value="service3">service3</option>
<option value="service4">service4</option>
</select>
Since "Please Select" is always the first item on any list, when you validate the form if there are any lists that default to the first item you generate an alert for the user and abort the form submission.
Of course you will still need to validate the same form server side because anyone with javascript disabled, which is a growing trend due to malware, will be able to submit your form with the defaults of "Please Select" intact.