How to reset a search form after using the query parameter
Hi Low,
On a search form, I'm using the following to reset the search options:
<button type="reset" value="Reset">Reset</button>
This works fine on a new search. But I've just noticed that when using the query parameter in order to remember the search criteria of a user's previous search, clicking the reset button only resets the form back to the previous query they made, not a completely reset form from scratch.
Can you think of a workaround for this at all?
Thanks,
Stephen
Replies
Low 25 Jun 2012 20:48
Hi Stephen,
Well, the default Reset button doesn't necessarily empty out a form, but returns it to the default state; the state in which it was loaded. Using the query="" parameter to remember a submitted search, will load the page in a filled out state, so the Reset button will revert to that state.
If you want to empty out the form, you'd have to use JavaScript.
Stephen 25 Jun 2012 23:05
Hi Low,
Thanks for clarifying. I'll take your advice and use JavaScript to do this.
Thanks,
Stephen