Support Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.






NOTE : Due to personal issue, this Ultimate WP Query Search Filter Plugin is no longer under development. Thanks for the support over the years.

Anyone that come across this page that want to find a realible saerch plugin, here are the list of potential replacements.

Plugin author will no longer giving support here, however you can still asking for help from other users here.
Pages: [1]
Author Topic: Enter to submit
SurfDog
Newbie
Posts: 5
Permalink
Post Enter to submit
on: November 15, 2014, 22:30

Sure I'm missing this somewhere (or not phrasing my search correctly) but...

is there any way to get rid of the input button and just have the search performed on hitting the Enter key? (along these same lines can the search box be "prepopulated" with a term - i.e. Search?)

tck30
Administrator
Posts: 530
Permalink
Post Re: Enter to submit
on: November 16, 2014, 04:59

Not quite understand what you meant. You meant you want to perform the search when the search button is hidden and in the meantime get rid of the auto search when inputs are changes?

New Add-On Plugins for Ultimate WP Query Search Filter has been released! Check it out now.

Buy Me A Beer! Thanks

SurfDog
Newbie
Posts: 5
Permalink
Post Re: Enter to submit
on: November 16, 2014, 14:27

no, basically I want the search performed when the user hits the enter button rather then having them hit the submit button. Here's a quick video that may explain it better(ps I'm not a coder but do understand basic HTML, CSS, JS, jQuery) - http://screencast.com/t/Gfum8iDv

tck30
Administrator
Posts: 530
Permalink
Post Re: Enter to submit
on: November 17, 2014, 02:26

You can try this script:

$('body').on('keypress','[id^=uwpqsffrom_]',function(e) {
		  if(e.keyCode == 13){
		    e.preventDefault();
		    method = $(this).attr('method');
		   	if(method == 'get'){ $(this).submit();}
			else{ process_data($(this));}
		  }
		});

New Add-On Plugins for Ultimate WP Query Search Filter has been released! Check it out now.

Buy Me A Beer! Thanks

SurfDog
Newbie
Posts: 5
Permalink
Post Re: Enter to submit
on: November 17, 2014, 16:24

Quote from tck30 on November 17, 2014, 02:26
You can try this script:

$('body').on('keypress','[id^=uwpqsffrom_]',function(e) {
		  if(e.keyCode == 13){
		    e.preventDefault();
		    method = $(this).attr('method');
		   	if(method == 'get'){ $(this).submit();}
			else{ process_data($(this));}
		  }
		});

somewhat ignorant; where do I place the code exactly?

tck30
Administrator
Posts: 530
Permalink
Post Re: Enter to submit
on: November 19, 2014, 09:04

Your header or footer, need to wrapped in document ready.
eg

jQuery( document ).ready(function() {
$('body').on('keypress','[id^=uwpqsffrom_]',function(e) {
		  if(e.keyCode == 13){
		    e.preventDefault();
		    method = $(this).attr('method');
		   	if(method == 'get'){ $(this).submit();}
			else{ process_data($(this));}
		  }
		});
});

New Add-On Plugins for Ultimate WP Query Search Filter has been released! Check it out now.

Buy Me A Beer! Thanks

SurfDog
Newbie
Posts: 5
Permalink
Post Re: Enter to submit
on: November 19, 2014, 14:27

This works - THANKS!!!

One last request :) - now that the "Search" button is gone we need to populate the form with some text that shows the user they can use this to search. Here a screen shot of what it would look like - http://screencast.com/t/Opm2bPOm

<hr />

Quote from tck30 on November 19, 2014, 09:04
Your header or footer, need to wrapped in document ready.
eg

jQuery( document ).ready(function() {
$('body').on('keypress','[id^=uwpqsffrom_]',function(e) {
		  if(e.keyCode == 13){
		    e.preventDefault();
		    method = $(this).attr('method');
		   	if(method == 'get'){ $(this).submit();}
			else{ process_data($(this));}
		  }
		});
});
tck30
Administrator
Posts: 530
Permalink
Post Re: Enter to submit
on: November 19, 2014, 17:38
add_filter('uwpqsf_string_search', 'add_placeholder', '' ,6);
function add_placeholder($stext, $id,$divid,$defaultclass,$divclass,$options){
$placeholder = 'the text here';
$stext  ='';
$stext  = '<div class="'.$defaultclass.' '.$divclass.'"><label class="'.$defaultclass.' '.$divclass.'-keyword">'.$options[0]['strlabel'].'</label>';
		$oldvalue = (isset($_GET['skeyword'])) ? $_GET['skeyword'] : '';
		$stext .= '<input id="'.$divid.'_key" type="text" name="skeyword" class="uwpqsftext" value="'.$oldvalue.'" placeholder="'.$placeholder.'" />';
$stext .= '</div>';
return $stext;
}

Notice the $placeholder variable.

New Add-On Plugins for Ultimate WP Query Search Filter has been released! Check it out now.

Buy Me A Beer! Thanks

SurfDog
Newbie
Posts: 5
Permalink
Post Re: Enter to submit
on: November 19, 2014, 18:06

Excellent - THANK YOU!!

Pages: [1]