Universal Grasp
Universal Grasp

Reputation: 1845

HTML <SELECT> Drop menu, show multiple but choose only one at time

Is there a way to have a select drop menu showing multiple options at ago but the user can only click on a single Item... How to restrict them from highlighting all options at ago even though they can see all the options?

Example

<form action="">
<select name="cars" multiple>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
<input type="submit">
</form>

<strong>They Should NOT Highlight or select more than one option at a go!!</strong>

I want the user to NEVER Highlight all options at ago because that will submit all options to the SERVER-SIDE Script and Err.

See it in action here: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple

Go to that link and try to highlight all options and Submit the query... You'll see all options are submitted. How to prevent that multiple highlighting even when they click CTRL+option after option?

Upvotes: 1

Views: 170

Answers (3)

arif_suhail_123
arif_suhail_123

Reputation: 2509

Dont use multiple set a size to it

<form action="">
<select name="cars" size="4">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
<input type="submit">
</form>

Upvotes: 1

cameronjonesweb
cameronjonesweb

Reputation: 2506

From: <select name="cars" multiple> To: <select name="cars">

Upvotes: 0

Weafs.py
Weafs.py

Reputation: 22992

Demo on Fiddle

HTML:

<form action="">
  <select name="cars" visible="volvo">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>
  </select>
  <input type="submit" />
</form>

Upvotes: 0

Related Questions