reset filter input fields not work

giusebos 11 Apr, 2016
this does not work

  <input type="button" onclick="myFunction()" value="Reset form">


<script>
function myFunction() {
    document.getElementById("admin_form").reset();
}
</script>



this does not work


<a class="btn btn-default" href="http://www.icagenda.it/connessione-rubrica.html?&srch=" role="button">reset</a>
&srch=


there is a way to empty textbox?
giusebos 11 Apr, 2016
this does not work

https://www.chronoengine.com/forums/posts/t101462.html
kohanb 19 Dec, 2016
I tried to make a reset button for the filter dropdown.
I planned that when clicking the reset button the values of the dropdowns would reset to the default values and the page would show the database before filtering (as if submit execute with the default empty values).

<div <div class="form-group" id="form-row-multi-2">
	<div class="gcore-subinput-container" id="fitem-category">
		<div class="gcore-input gcore-sub-input gcore-display-table" id="fin-category">
			<select name="fltr[participants][age_category]" id="category" size="" class="form-control" title="" style="" data-load-state="" data-tooltip="" type="text" />
			<option value="" selected="selected"></option>
			<option value="M 16-29">M 16-29</option>
			<option value="M 30-39">M 30-39</option>
			<option value="M 40-49">M 40-49</option>
			<option value="M 50+">M 50+</option>
			<option value="F 16-29">F 16-29</option>
			<option value="F 30-39">F 30-39</option>
			<option value="F 40-49">F 40-49</option>
			<option value="F 50+">F 50+</option>
			</select>
			<span class="help-block">_CATEGORY_</span></div>
	</div>
	<div class="gcore-subinput-container" id="fitem-distance">
		<div class="gcore-input gcore-sub-input gcore-display-table" id="fin-distance">
			<select name="fltr[participants][distance]" id="distance" size="" class="form-control" title="" style="" data-load-state="" data-tooltip="" type="text" />
			<option value="" selected="selected"></option>
			<option value="Maraton">Maraton</option>
			<option value="Cross">Cross</option>
			</select>
			<span class="help-block">_DISTANCE_</span></div>
	</div>
	<div class="gcore-subinput-container" id="fitem-submit">
		<div class="gcore-input gcore-sub-input gcore-display-table" id="fin-submit">
			<input name="submit" id="submit" type="submit" value="_FILTER_" class="btn btn-info" style="" data-load-state="" />
		</div>
	</div>
		<div class="gcore-subinput-container" id="fitem-reset">
		<div class="gcore-input gcore-sub-input gcore-display-table" id="fin-reset">
			<input name="reset" id="reset" type="reset" value="_RESET_" class="btn btn-warning" style="" data-load-state="" />
		</div>
	</div>
	
	<div class="clearfix"></div>
</div>

<script>$(document).on('click', 'reset', function(e) {
    var opt = $('select').val(0).children('option').filter(function(i){ return this.hasAttribute('selected') });
    opt.prop('selected', 'selected');    
});</script>

 _PAGINATOR_LIST_
<br />
Max_admin 20 Dec, 2016
Answer
Hi,

Just use a link with an empty fltr variable:

<a class="btn btn-default" href="http://www.icagenda.it/connessione-rubrica.html?&fltr=" role="button">reset</a>


That should work!

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kohanb 20 Dec, 2016
WORKING!
Thank You Max!!!🙂
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger