1. drjjw
  2. General
  3. Friday, January 08 2021, 09:45 PM
Hello,

Is there any way with Javascript you can clear or reset the search parameters without having to reload the page? I am using the Ajax option but can't seem to reset

Jordan
admin Accepted Answer
Admin
Hi,
with Joomla template override feature you can add a "Reset" button in search module or users list component view. for example if you use a search module the follow these steps:
- Create template override: copy file from /modules/mod_jsnsearch/tmpl/default.php in /templates/your-theme-folder/html/mod_jsnsearch/default.php
- In the new file at line 98 add the following code
<input type="button" onClick="this.form.reset();jQuery(this).next().click();" class="btn btn-primary" value="Clear" />
  1. more than a month ago
  2. General
  3. # 1
drjjw Accepted Answer
Pro
Thanks very much. That works for text boxes but not for select boxes (both the Chosen [chzn] boxes and the version of select boxes which appear on iphone)
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
try with this code please
<input type="button" onClick="this.form.reset();jQuery('select').trigger('liszt:updated');jQuery(this).next().click();" class="btn btn-primary" value="Clear" />
  1. more than a month ago
  2. General
  3. # 3
drjjw Accepted Answer
Pro
Will do.

And we want to also add to the view for the menu item search, what is the file location for that override?
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
- Create template override: copy file from /components/com_jsn/list/tmpl/default_search.php in /templates/your-theme-folder/html/com_jsn/list/default_search.php
- In the new file at line 87 add the same code

If you use the table users list menu item instead the normal user list menu item then the file is called "table_search.php"
  1. more than a month ago
  2. General
  3. # 5
drjjw Accepted Answer
Pro
Thanks! That worked except for a very small issue. When you clear the from, the list odes not update unless you also click outside the button after clearing it on a click. I have added the form to the site details below
  1. more than a month ago
  2. General
  3. # 6
drjjw Accepted Answer
Pro
I fixed it. I moved it prior to the search button
  1. more than a month ago
  2. General
  3. # 7
drjjw Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.