Drop Down List Inside Form.... How To Trigger The Action Without Button?
Solution 1:
You need javascript for that.
Although you should use unobtrusive javascript, the basic code looks something like:
<select onChange="document.forms['form1'].submit();">
You attach an event handler to the change
event and have it submit the form.
Solution 2:
This will require JavaScript, but if you are wiling to use jQuery then this is really easy. With jQuery it would be:
$('#form1 select').on('change', function() {
$('#form1').submit();
});
In JavaScript you are binding the onChange event of the select
element. One way to do this is:
<select onChange="document.form1.submit()">
Solution 3:
The simplest way is to use javascript straight with your select element. The event is onChange.
<select onchange="javascript:document.form1.submit();">
You can also go for jQuery based forms. Download jQuery javascript from http://jquery.com/ and include it in your HTML. After that, use :
<select id="sort">
And, inside your :
$(document).ready(function(){
$("#sort").change(function() {
$(this).parent().submit();
});
});
Post a Comment for "Drop Down List Inside Form.... How To Trigger The Action Without Button?"