Forums › Forums › Search & Filter Pro › Pass the search value between forms/results
Tagged: multiple forms, Pass values, User experience, V3
- This topic has 20 replies, 2 voices, and was last updated 4 years, 1 month ago by Anonymous.
-
Anonymous(Private) November 13, 2020 at 1:46 pm #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, withOnly 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 ๐
Anonymous(Private) November 13, 2020 at 1:56 pm #266379Also 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
Anonymous(Private) November 13, 2020 at 2:05 pm #266383Hi,
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 needbut if you could explain me the porces to set this up it might be easier ๐
Thank’s
Anonymous(Private) November 13, 2020 at 2:07 pm #266385Haha 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(Private) November 13, 2020 at 2:23 pm #266388The 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(Private) November 13, 2020 at 2:39 pm #266396Hi 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 pageAdvanced form
Several search field including text search
unlimited result paginated
any post-typethe 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 solutionCan 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 ?
Trevor(Private) November 13, 2020 at 3:03 pm #266406Try 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?
-
AuthorPosts