Clear form after submission

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Clear form after submission

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37836
    spinoWeb
    spinoWeb
    Participant

    Hello,
    I have a search form at home. On the search results page I have the same form again, but I would like the form to be clean.
    That is, I would like it so that after I click on the search button, i go to search results page, and the form there does not keep track of the search done but it’s clean.
    I cannot find this option.

    Thanks

    #37841
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Well, there is no option to do that, the plugin will automatically fetch the posted options. It might be however possible via a minor custom code snippet.

    Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    add_filter('asp_shortcode_search_options', 'asp_reset_options_on_results_page', 10, 1);
    function asp_reset_options_on_results_page($settings) {
    	unset($_POST['p_asp_data']);
    	unset($_GET['p_asp_data']);
    	
    	return $settings();
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #37845
    spinoWeb
    spinoWeb
    Participant

    hello,
    I think there are some parentheses that don’t fit in
    return $settings();
    However removing the parentheses
    return $settings;
    it works but only for filters, I would like the main search field to be clean too.

    Thanks again

    #37854
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You are correct, that was my mistake.

    To clear the input field, you need an additional code as well:

    add_filter("asp_print_search_query", "asp_change_print_search_query", 10, 2);
    function asp_change_print_search_query($query, $search_id) {
      return '';
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #37857
    spinoWeb
    spinoWeb
    Participant

    Everything works fine!

    Thanks

    #37858
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.