This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3429
    BastienBastien
    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 11 years, 4 months ago by BastienBastien.
    #3433
    Ernest MarcinkoErnest 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:
    [html]
    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();
    }
    });
    });
    [/html]

    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.

    #3435
    BastienBastien
    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
    BastienBastien
    Participant

    Hi,

    I have moved my other question in a specific post.

    Thanks

    Bastien

    • This reply was modified 11 years, 4 months ago by BastienBastien.
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.