Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Behaviour not to be redirected when searching
- This topic has 3 replies, 2 voices, and was last updated 11 years, 4 months ago by
Bastien.
-
AuthorPosts
-
January 11, 2015 at 8:26 pm #3429
Bastien
ParticipantHi,
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
Bastien.
January 12, 2015 at 3:37 pm #3433Ernest Marcinko
KeymasterHi!
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.
January 12, 2015 at 4:17 pm #3435Bastien
ParticipantHi 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,
BastienJanuary 12, 2015 at 6:39 pm #3436 -
This topic was modified 11 years, 4 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.