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.

Multi-field search?

  1. maharzan
    Member

    Hi all,

    I am trying to do this..

    First, I want to use Gravity Forms to do a simple search on the database saved. But if I use it, each search is just saved in the database and I cannot search the database. How do we not saved those search text but then grab that search text such as $_POST["searchtext"] ? Is that even possible currently? If it is, please suggest how to achieve this?

    Second, I have another form that has multiple category fields and text fields. Here is what I want to do. I want to have another form that is basically a search again but more like Advanced search. I want to have 3-4 fields so user can select each field and then we need to send those options to query. I only see the search has 1 field and search like %searchtext% in the sql. Do we have to add another function that specifically might do this?

    Thanks so much.

    Posted 13 years ago on Sunday August 1, 2010 | Permalink
  2. Gravity Forms is designed to store data, not to be used as a search form as it posts the data you submit via the form. It sounds like for a search form you would need some sort of custom application as GF doesn't do searches on the front end.

    There is an API hook you can use to override the form action url and point it to any action, however you would have to point it to a PHP form handler that does the search and write that functionality yourself. Gravity Forms itself doesn't act as a search engine.

    <?php
    add_filter("gform_form_tag", "form_tag", 10, 2);
    function form_tag($form_tag, $form){
    $form_tag = preg_replace("|action='(.*?)'|", "action='custom_handler.php'", $form_tag);
    return $form_tag;
    }
    ?>

    That is an example of using the gform_form_tag filter to change the form action for the form.

    Posted 13 years ago on Sunday August 1, 2010 | Permalink
  3. maharzan
    Member

    Thank you Carl. I will try that. I did find a way to search multiple data so I can use gravity forms as an advanced search engine. It can be a good addition to gravity forms and not limiting it to just saving data. I see very good chances of this becoming a full application for huge databases as well. :)

    Posted 13 years ago on Monday August 2, 2010 | Permalink
  4. Hello Maharzan,

    You mention above you found a way to search multiple data, are you willing to share that? I've been looking for such functionality for some time, I couldn't find a good solution yet.

    thanks in advance.

    Posted 13 years ago on Monday August 2, 2010 | Permalink
  5. maharzan
    Member

    Hi Koeleman,

    I will post that a bit later. I have been successful but I am testing all the functionality and trying to integrate it into GF function so we have minimum code changes.

    Thanks for asking!

    Posted 13 years ago on Wednesday August 4, 2010 | Permalink
  6. anointed
    Member

    I was thinking about the same concept a few weeks back, but the task was way to advanced for my current abilities. This could actually open up a huge amount of new possible case uses for gravity. Great job.

    +1 on this plugin concept

    Posted 13 years ago on Wednesday August 4, 2010 | Permalink
  7. spotmouse
    Member

    don't forget me to ;-)

    Posted 13 years ago on Monday December 13, 2010 | Permalink
  8. Add me to the list. Being able to use GF to search on specific custom fields would be great.

    Posted 13 years ago on Friday December 24, 2010 | Permalink
  9. Add me to the list as well, please.

    I am creating a directory. It needs an advanced search plus an alphabetical listing of the submitted directory items.Has anyone any solution for that?

    Posted 13 years ago on Friday January 7, 2011 | Permalink
  10. @Surena:

    For Custom Fields Search I'm using 'wp custom field search', does the job.

    For alphabetical listing of posts try 'AZIndex'.

    Posted 13 years ago on Friday January 7, 2011 | Permalink
  11. @Surena The only solution I am aware of is the Gravity Forms Directory Add-On that is in the WordPress.org repository. We did not create it, a Gravity Forms user did, but I believe it has some sort of search functionality for the frontend.

    Posted 13 years ago on Friday January 7, 2011 | Permalink
  12. I would looooove such an add-on. The Wordpress search function is so freaking limited.
    The hability to create different forms with different drop-down form fields (one could be for custom fields, one for category a.s.o) and display all posts that match that criteria... that would be amazing.
    I had four clients with travel and real estate related websites. For the advanced search part I had to pass everytime (not much of a programmer).
    I already have a developer license but wouldn´t even mind paying a bit extra for that add-on :)

    Posted 13 years ago on Wednesday April 6, 2011 | Permalink
  13. Yes, I would like to know if a multiple data search query is possible...
    For example find the words "female + united states + singer + jazz"
    Hope you have something like this in the near future.

    Posted 12 years ago on Thursday September 29, 2011 | Permalink