Skip Navigation

[Resolved] Display search results on a separate page

This support ticket is created 3 years, 8 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 11 replies, has 2 voices.

Last updated by lesT 3 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2072033
Toolset 5.png

Your documentation for directing output to a different page shows this method;
[wpv-form-view name="Search" target_id="99"]

However I do not see that shortcode used (see uploaded image)
can you please advise how I apply target_id in this case

#2072197

Hello,

Please check our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-form-view
attributes: 'page_ID' | 'self'
Use the ‘page_ID’ to set the ID of the target page where the view results will be displayed.

For example, after user submit the search form, you can redirect user to one specific page(ID 123), then you can setup page_ID attribute as 123, like this

[wpv-form-view name="search" target_id="123"]

#2072989
Toolset 8.png

Based on my changes to code I am perhaps not understanding
I had: [wpv-view name="Pilots-Display-Zone" zone= "[urlparam param= 'zone' /]"
which put the results on the same page as the query (which I displayed with:
[wpv-post-body view_template="loop-item-in-pilots-display-zone"]

I changed the wpv-view to wpv-form-view as follows (and got no output on either the target page or on the originating page)
[wpv-form-view name="Pilots-Display-Zone" zone= "[urlparam param= 'zone' /]" target_id="93757"]
similarly I got no output to the originating page by:
[wpv-form-view name="Pilots-Display-Zone" zone= "[urlparam param= 'zone' /]" target_id="self"]

Note page with ID 93757, is just a blank page
Thanks for your help

#2073231

I have tried it in my localhost(fresh WP installation + the latest version of Toolset plugins) without the custom shortcode [urlparam param= 'zone' /] you mentioned above
It works fine in my localhost, so the problem you mentioned above is abnormal, please check these:

1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to WordPress default theme 2021, deactivate all custom PHP/JS code snippets, remove zone= "[urlparam param= 'zone' /]" from the shortcodes you mentioned above, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

4) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2074255

I have requested the access to your google drive disk link, please grant it, thanks

#2074275

granted

#2074341

I can download the files, will update here if find anything

#2074429

I can install the duplicator package in my localhost.

Please try these:
1) Edit the view "Pilots new test":
hidden link
in section "Loop Editor", you are using below shortcode:
[wpv-form-view name="Pilots-new-test2" target_id="93757"]

This is another search form of view "Pilots new test2" shortcode,

2) Edit that view "Pilots new test2":
hidden link
There isn't any search form in it, you can click "Screen options", enable option "Custom Search Settings", then setup a custom search form it.

3) Test the problem page again:
hidden link
I can see the search form correctly, submit the search form, it redirect me to correct page "Map Results", which page ID is 93757

#2076685

I clearly do not understand what I am doing, and so I cleaned up my test pages/views for you

Page "Pilots test" (ID=93779) queries custom type Pilots via the Pilots test View (Slug=pilots-test, ID=93779)
-- the "Pilots test view" - simply returns the first 10 items in Post Date order
** the view is intended to display the 10 items via a view template, and create 10 map markers**
--------------------no problem up to here-------------------

The [wpv-form-view name="Pilots-test-results" target_id="93781"]
** is intended to show the same 10 items in the same order on a different page **
-- the page "Pilots test results" (ID=93781, Slug=pilots-test-results) is intended to show the same items
-- Page "Pilots test results" uses "Pilots test results" view (ID=93783) to display two fields
-- this view does a query on the Pilots custom type to return 10 items in date order

*** I'm not sure if this is correct or even necessary - but it seems this is what you wanted ***
I'm not getting the expected results
Please advise or feel free to modify the two pages and two views if that is easier
Regards, Les

#2076695

Please share your website credentials in below private message box, I can setup a demo for you

#2076879

For the original question of this thread: [wpv-form-view]

I have done below modifications in your website:
1) Edit the post view "Pilot Test Results":
hidden link
In section "Search and Pagination", add a very simple search form and search inputs

2) Edit the post view "Pilots Test":
hidden link
In section "Loop Editor", line 9, change the shortcode as below:
[wpv-form-view name="pilot-test-results" target_id="93781"] <!-- display each market detain on a different page -->

You can use view slug as above "name" attribute

3) Test it in front-end:
hidden link

It does outputs the search form of step 2) correctly, and submit the form, it does redirect me to the same page, which page ID is "93781".

Please check it, thanks

#2085185

Re your ticket/reply #2076879
I have used your suggestion and it seems to work, however there appears to be a difference between how:

[wpv-view name="Pilots-Display-Zone" zone= 'AU' target_id="93819"], works and how this works
[wpv-form-view name="Pilots-Display-Zone" zone= 'AU' target_id="93819"]

I have a diagnostic at the start of the view:
[wpv-found-count] [wpv-attribute name="zone"] Pilots found <br>
this shows "AU" in the first case and nothing in the second case

obviously, the results come back to the issuing page for wpv-view and go to a different page for wpv-form-view

If you still have access the Pages involved are:

MAP && MAP DISPLAY ZONE
the corresponding views are
Pilots Parent view && Pilots Display Zone

I am suspecting wpv-form-view does not allow parameters to be passed

I have marked the offending code in "Pilots Parent view" with an "xx" to make it easier to find

thank you for your previous help