Behaviour not to be redirected when searching

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Behaviour not to be redirected when searching

This topic contains 3 replies, has 2 voices, and was last updated by Bastien Bastien 9 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3429
    Bastien
    Bastien
    Participant

    Hi,

    I am very impressed by Ajax Search Pro. Admin panel is impressive.

    I wanted to have the behaviour as in the demo on the page http://wp-dreams.com/demo/wp-ajax-search-pro3/woocommerce-example/.

    When I click the search icon or the return key, there is no redirection to the search page. I tried to do it by putting off the two parameters I found in the admin section in “General Options” > “Behaviour”. I join a screenshot.

    But even with the set up, when hitting the return key or the search icon, I am redirecting to the search page.

    I want the behaviour to force the user to select one the results.

    Thanks a lot for your help.
    Have a nice day,

    Bastien

    • This topic was modified 9 years, 3 months ago by Bastien Bastien.
    Attachments:
    You must be logged in to view attached files.
    #3433
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I’m suspecting a 3rd party javascript (probably from another plugin or theme) which automatically submits the form when pressing the enter key. The search tries to automatically prevent this behaviour, but depending on the method it might fail.

    The best you can try is the following javascript code:

    
    jQuery(document).ready(function($){
      var scope = $;    
      if (typeof aspjQuery != "undefined")
          scope = aspjQuery;     
      scope(".proinput input.orig").keydown( function(e) {
        if (e.which === 13) {
          e.preventDefault();
          e.stopPropagation();
          if (typeof(e.stopImmediatePropagation) != "undefined")
            e.stopImmediatePropagation();
        }
      });
      scope("input.orig").parent().submit( function(e) {
        if (e.which === 13) {
          e.preventDefault();
          e.stopPropagation();
          if (typeof(e.stopImmediatePropagation) != "undefined")
            e.stopImmediatePropagation();
        }
      });
    });
    

    Try to add it to the page footer or header. It might work, but if another javascript file is interfeering with the event listeners this might not work.

    Also, try to clear your page as well. If you are using any kind of CDN, then their cache as well. The cache can prevent such settings from application.

    Best,
    Ernest Marcinko

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


    #3435
    Bastien
    Bastien
    Participant

    Hi Ernest,

    I think you are right as there is a plugin or the theme which is interfering with this event.

    Your snippet works perfectly. Thanks for it and for the awesome support.

    Best,
    Bastien

    #3436
    Bastien
    Bastien
    Participant

    Hi,

    I have moved my other question in a specific post.

    Thanks

    Bastien

    • This reply was modified 9 years, 3 months ago by Bastien Bastien.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.