Skip Navigation

[Gelöst] Search not returning results after changing search button to fa-search icon

This support ticket is created vor 3 Jahre. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 Antworten, has 2 Stimmen.

Last updated by davidm-13 vor 3 Jahre.

Assisted by: Christian Cox.

Author
Artikel
#2017121

Hi,
I have this view shortcode:

      [wpv-form-view name="complaints-plant-search" target_id="42584"]

Which was returning result to the target_id page.
I changed this code in "complaints-plant-search":

[wpv-filter-controls]
<div class="form-group">
	<label for="wpv-post-search" class="label-right">[wpml-string context="wpv-views"]Medical Complaint / Use[/wpml-string]</label>
	[wpv-filter-search-box output="bootstrap"]
    [wpv-filter-submit name="Search"]
</div>
[/wpv-filter-controls]

To this:

[/wpv-filter-controls]
<div class="search4complaint">
	<label for="wpv-post-search" class="label-right">[wpml-string context="wpv-views"]Medical Complaint / Use[/wpml-string]</label>
  <div class="input-group">
    <input type="text" class="form-control" placeholder="Enter medical omplaint">
    <div class="input-group-append">
      <button class="btn btn-secondary" type="button">
        <i class="fa fa-search"></i>
      </button>
    </div>     
    </div>
  </div>
[/wpv-filter-controls]

Now the search is not returning any results or any errors - what do I need to get the search working again?

Thanks

#2017483

Hello, you'll need to at least add the input name attribute wpv_post_search to your custom text input field like so:

<input type="text" class="form-control" placeholder="Enter medical omplaint" name="wpv_post_search">

Without that name, URL parameters required for search will not be passed to the target page.

If you want the searched term to appear in the text input field value by default, you can use the views shortcode wpv-search-term in the value attribute as well, like so:

<input type="text" class="form-control" placeholder="Enter medical omplaint" name="wpv_post_search" value="[wpv-search-term param='wpv_post_search']">

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term

#2017597
search-icon.JPG

Hi Christian, Thanks for this.
Your code works fine, but there appears to be another problem, if I click on the fa-search icon there's no response, but clicking in the "Enter medical complaint" area (after entering search term) works as required.
Any idea how I can get the same result clicking the icon?
Thanks

#2017613

Since this is a custom UI that doesn't use the standard Views inputs shortcodes, I don't have a cut-and-paste solution for you. You'll need some custom JavaScript to trigger the form submission event when the button is clicked. You can use jQuery in the 'jQuery' namespace, instead of the '$' namespace:

jQuery(document).ready(function(){
  // add your code here using the jQuery namespace instead of $
});

If the icon click event triggers a form submission event, it might work. Similar example:
https://www.tutorialrepublic.com/faq/how-to-submit-a-form-using-jquery.php

#2017639

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.