PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Use Gravity Forms to search for tags

  1. Hello,

    I have come across some topics about using Gravity Forms as an advanced search widget but didn't see any completed answers.

    What I would like must be do-able with Gravity Forms. Basically I want to have 3-4 dropdown menus which contain my defined tags and when the user presses the search button, then the form should redirect to searching for the selected tags.

    any tips on how to achieve this would be much appreciated.

    Andy

    Posted 11 years ago on Saturday December 15, 2012 | Permalink
  2. ok, I have made some significant progress by using the redirect option in gravity forms and Pass Field Data Via Query String.

    The problem now is to convert the resulting URL when the user presses submit from:

    http://www.mysite.com/?tag/New+Build+2+Bedrooms

    to

    http://www.mysite.com/tag/New-Build+2-Bedrooms

    for the search to function properly. i.e.

    1. Remove the question mark (?) added by Pass Field Data Via Query String
    2. Convert spaces between words to dash -

    could be done using regular expressions?

    Posted 11 years ago on Sunday December 16, 2012 | Permalink
  3. It can be done using the PHP function str_replace. Take a look at this code example:
    http://pastie.org/5111190

    Instead of stripping out the dollar sign, you could remove the question mark, and also convert spaces to dashes. All your work will be done on line 8 of that code example.

    Posted 11 years ago on Wednesday December 19, 2012 | Permalink
  4. Zamir
    Member

    Hi,
    I am using GF "Post Fields" to create a form where users will create the WordPress posts (automatically published if user is logged in).

    Now, if I am to use GF for search as well, I understand I will use the "Pass Field Data Via Query String" option, and user will be re-directed to a page (or post), and the address of new page (or post) will contain all the tags the selected in the GF "search" form. Then I will manipulate the URL and form my WordPress search query and display the posts (search results for searched tags).

    I hope I understood correctly.

    My question: For search form, I'll again use the "Post Fields" with drop-down lists that will be identical to the ones I used to generate the content. Now, when I am using them for search, and user presses the "Search" button, and will be redirected to a page (or post), will it create another WordPress post as well? What I mean is, when I am trying to use GF as a "search" form, then I don't want to create new WP posts on result of the search queries.

    Do you understand what I am asking?

    Posted 11 years ago on Thursday June 13, 2013 | Permalink