Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Auto-submit dropdown menu (See related posts)

Many users assume that a <select> element (dropdown menu)
will have its effect without pressing submit button.
(poor user...). The solution is to have it submit automatically.
<select name='myfield' onchange='this.form.submit()'>
<option .... >
...
</select>
</form>

Simply onchange='this.form.submit()'

Comments on this post

antti posts on Nov 08, 2005 at 19:02
Remember to add a submit button for those who don't have javascript:
...
<noscript><input type="submit" value="Submit"></noscript>
</form>

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts