Reputation: 1414
I want to reload the page when the option is selected. The form is used to select and delete all selected.
My code:
function change() {
document.getElementById("sort_filter").submit();
}
<form action="action/delete.php" id="select_delete_form" method="get">
<div class="btn-group">
<a href="#check-all" class="btn btn-primary" id="check-all">Select All</a>
<input type="submit" class="btn btn-danger" value="Delete Selected" onclick="return deleletconfig()">
</div>
<select id="sort_filter" name="sort_filter" method="get" onchange="change()">
<optgroup label="Sort by">
<option value="new">Newest</option>
<option value="old">Oldest</option>
<option value="most">Most Popular</option>
<option value="less">Less Popular</option>
<option value="user">Owner</option>
</optgroup>
</select>
<input type="checkbox" value="11111" name="deleteid[]">
<input type="checkbox" value="22222" name="deleteid[]">
</form>
Upvotes: 2
Views: 905
Reputation: 36351
You need to call submit on the form element not the select element
function change(){
document.getElementById("select_delete_form").submit();
}
If submiting isn't what you are looking for, then maybe a form reset would be better?
function change(){
document.getElementById("select_delete_form").reset();
}
If you truly want to reload the page, then:
function change(){
window.location.reload();
}
Upvotes: 2