Forums Forums Search & Filter Pro Pass the search value between forms/results

Viewing 10 posts - 1 through 10 (of 21 total)
  • Anonymous
    #266371

    Hi there

    Short version
    How can we pass the value.s of the search done on one form to an another ?
    OR
    How can we pass the value.s of a search from on a page, to the same form on an other page ?

    Use case / whished behaviour

    let’s consider we have two pages “basic search” and “advanced search”.

    On the basic search page, one may do a basic search, and be invited to do a advanced search (with a button or a link). On click, the user will be directed to the advanced search page, and when the advanced search will be “pre-populated” with the value entered in the basic search page.

    the idea is to offer more search option on the advanced search page, as well as display more details on each result.

    Example of set up

    To my understanding this could be achieved in different way.

    Each page has their very own forms and result template (all displayed with S&F shortcode) and we “send the values from one to the other”

    Alternatively, we may use only one form. The form and result shortcode would be contained in a div with a different class on each page, for instance .basic-search and .advanced-search and use selector to hide search field, and result details on the basic search page.
    We would then still need to pass the value of the field set in the basic search to the advanced search.

    Further complication
    On further complication may stem :
    As I want the basic search to be used not only in one page, but many (like in a sidebar used on few pages) I won’t be able to provide a (unique) display result url.
    This might not matter as the basic seach is done in ajax, with Only use Ajax on the results page? not ticked, and the user won’t have a submit button.

    Also, I may prefer not to have Make searches bookmarkable? ticked, but I’m not sure of the consequences of that yet (I first need to pass the data)


    Hope you may help with that, the result would greatly enhence the user experience !

    Thank’s for your attention ๐Ÿ™‚

    Trevor
    #266377

    It should normally be possible. Can you give me an example on your site?

    I would need:

    #1 The search term
    #2 The page URL that has the basic search form
    #3 The page URL that has the advanced form

    Anonymous
    #266379

    Also one difficulty one might encounter if using the same form is that on the basic search I only want to display the 5 more relevant result (all set nicely with relevanssi, nice integration by the way) while on the advanced search I want every result.

    An other advantage to have two diferrent form is that the first form may search in page and post, while the advanced search on other post-type for instance ๐Ÿ™‚

    cheers

    Trevor
    #266381

    I think our posts passed in the ether. Do you mean that you would sometimes want to stay on the origin page, and sometimes go to the advanced search page?

    Anonymous
    #266383

    Hi,

    haven’t seen your reply…

    two things,
    – I don’t know if I should only built one form or two (at the moment I only have one)
    – the site I’m working on is under construction, with no public access yet, I may create you an account if you really need

    but if you could explain me the porces to set this up it might be easier ๐Ÿ™‚

    Thank’s

    Anonymous
    #266385

    Haha again our post passed in the ether

    Sorry about that

    yes exactly, I want the user to be able to do a search and display the resut on the basic page, where he is also inviter to doan advanced search.

    But I wouldn’t be nice in term of user experience to simply send him to a different page, the idea is to get the search he did on the basic page, and use it on the advanced page when he land here ๐Ÿ™‚

    Trevor
    #266388

    The second option, where the search on the origin page always goes to the results page, is easy.

    Have two forms. For this example, I will assume some basic design:

    #1 On the origin page. Have just a Text search field. Display Results Method set to Custom, URL set to the Advanced Search Results Page, AJAX off.

    #2 On the Advanced Search Results Page. Has a Text Search field and other fields. This form set as you wish.

    The search text from the origin page and form 1 will pass to form 2.

    Anonymous
    #266396

    Hi again ๐Ÿ™‚

    Ok, that’s a cool way to pass the data, we are getting closed but not quite there yet.

    The idea is to display some “basic” result on the basic search page, in ajax, and add a link or button at then end of the results template (out of the loop) to go to the advance search. The user may or may not go to the advanced search, he do not have to, but may, and if so, instead of a simple link to the advanced search page, the data is passed to the advanced form/results (and if it is not the same form the result may be different) ๐Ÿ™‚

    let’s say

    Basic form
    only text search
    only 5 result, no pagination
    only post-type page

    Advanced form
    Several search field including text search
    unlimited result paginated
    any post-type

    the idea is to be able to do a basic search, and extend it to the advanced one, without having to resubmit the value entered on the basic search

    (this is important since the basic search will actually have 2 to 4 field, while the advanced one 5, and broaden categories and post-types)

    This is what I would really like to achieve?


    possible solution

    Can we get the form field value into the result template ?

    then we could generate a html link with php var values
    $formfield1 = get_S&F_field_1_Value
    $formfield2 = get_S&F_field_2_Value

    “&field2=<?php echo $formfield2 ?>” />

    or something like this ?

    Anonymous
    #266398

    sorry forgot to use the code tag

    <a href="http://mydomain.net/advanced-search.php?field1="<?php echo $formfield1 ?>"&field2=<?php echo $formfield2 ?>"> Extend your search <a/>

    Trevor
    #266406

    Try making three forms?

    The third form identical to form 2, but set to Custom no Ajax and pointing to the other page.

    Then, modify form 1 to be a normal form with results on that origin page.

    On the origin page, also have form 3. Don’t worry that it is visible for now, this is just a test.

    Then, when you do a search, do the fields in forms 1 and 2 set themselves the same?

Viewing 10 posts - 1 through 10 (of 21 total)