Solved Search form to filter multiple lists

Hi
I'm trying to filter multiple lists using a single search form.
I found this old forum thread which I've followed but it's not working correctly: https://fabrikar.com/forums/index.p...-lists-simultaneously-in-a-single-page.36058/

The search form is a standalone Fabrik form, (set up not to save to database) with a redirect plugin with this in the "jump page" section:
index.php?option=com_content&view=article&id=2&Itemid=118&param1={person_search___ap_person_search_raw}
(where this form element is a databasejoin linking to a table of people's names.)

The article which displays the page has this:
{fabrik view=form id=9} (the search form)
{fabrik view=list id=5 ap_all_productions_3_repeat___ap_crew_member=[param1] } (first list)
{fabrik view=list id=6 ap_all_productions_4_repeat___ap_actor=[param1] } (second list)

The search form dropdown correctly displays a list of all the names in the table but I've got two problems:
1) When I select a name I get this error message:
"{"msg":"","url":"\/productions\/index.php?option=com_content&view=article&id=2&Itemid=118¶m1=1&isMambot=1","baseRedirect":false,"rowid":"","suppressMsg":true,"redirect_how":"samepage","width":300,"height":300,"x_offset":0,"y_offset":0,"title":"","reset_form":true}

I don't understand why "param1" has been mangled like this. However, the =1 is the correct id of the person selected.
If I manually type in the correct url (e.g. index.php?option=com_content&view=article&id=2&Itemid=118&param1=1) the first list is correctly filtered.

2) Although the first list can be displayed correctly (if manually typed as above), the second list is not being correctly filtered. As the list filter is enabled, I can see that the correct name is appearing in the list filter but no filtering is taking place.

Any ideas anyone?
 
Hi there!

Two lines of investigation:
For 1) Rename your param1 to something else, more unique. It might be that param1 clashes with some other code somewhere.
For 2) Check the settings of the filtering: Is it "on change" or "on click"? This is done in the list section. As the first list is displaying well, make sure the settings of the second list are the same.

Kindly,
Lorenz
 
Thanks @lori19

1) I tried renaming "param1" to "person" but still got the message instead of the filtered page, although now the message contained "...person=1" so maybe that was causing a problem. In the end, I abandoned the redirect plugin and used a php plugin with the following code (onAfterProcess):
Code:
$myapp = Joomla\CMS\Factory::getApplication();
$myapp->redirect(Joomla\CMS\Router\Route::_("https://www.amdramwebdesign.co.uk/productions/index.php?option=com_content&view=article&id=2&Itemid=118&person={person_search___ap_person_search_raw}"));

This worked! The first list was correctly displayed.

2) Yes, the filtering of both lists is set to "on change". Although the php plugin is placing the filter in the second list, the filter itself is not being actioned. After more searching in the forum, I found an old thread on the topic where @cheesegrits has said you can't search two lists at once: https://fabrikar.com/forums/index.php?threads/make-a-homepage-search-module.33418/.
Yet @troester has posted since that it should be possible?
 
Filtering two lists via content plugin and url param is working fine on my site.

Make sure there's no caching (of the article), no typo or additional spaces in your content string (is the 2nd list working if you remove the 1st one?).
You can try if adding resetfilters=1 in the content string will help.
{fabrik view=list id=6 ap_all_productions_4_repeat___ap_actor=[param1] resetfilters=1}

Redirect plugin: I assume it will do with "Content Redirect" = "Same Page".
 
Thanks @troester - it's reassuring to know it SHOULD work.

Worth mentioning that both lists are copies of one single list with multiple groups, but each one shows details of different repeating groups - could this be causing problems?

I emptied the browser cache, Joomla cache and the template cache and got the same result. Yes, the second list works perfectly if I disable the first list. I tried adding resetfilters=1 as you suggested and got a very small victory: the one person who should appear in both lists DID appear in both lists, but I got the same empty result in the second list for everyone else. However, this was only temporary and stopped working after a while!

There is definitely something strange/unstable going on: I disabled the first list and searched for each actor and they all appeared correctly in the second list. When I re-enabled the first list, they did not appear in the second list, EXCEPT for the last person I had searched for! That one person is still appearing in the second list, despite having again cleared the browser, template and Joomla caches!

I've attached a screenshot of the article with the search form at the top. I made the filters visible for each list so you can see that the search form is picking the correct person from the second list, just not displaying the results. The person shown is the one person who should appear in both lists.

(I'm not using the redirect plugin in the form. I kept getting an error message so I'm using a php plugin instead - see above)

Probably should have stated at the outset, sorry: This is a clean install of J5.0.3 and F4.0 (GitDate: 2024/03/06) on a test site with PHP 8.1.27
 

Attachments

  • Screenshot search form 2 lists.png
    Screenshot search form 2 lists.png
    56.7 KB · Views: 19
Enable Fabrik debug (in Fabrik Options/Debugging)
Then you can append &fabrikdebug=1 to the URL (in the redirect or manually in the browser) and see the generated queries.

It doesn't make sense to have a filter block on lists displayed via content plugin with element filtering.
These content filter conditions are sticky, you can't clear them.
You can add showfilters=0 to the content plugin.
 
OK, thanks @troester
There are two additional lines in the query for the second list. Looks like it's still looking for the element from the first list:
1712403136790.png

So, is this because both lists are copies of one original list? They both have all the same elements?
 
Maybe not. I unlinked the Crew Member element from the Cast list and unpublished it and now the two lines above do not appear in the debug query - in fact, both queries are identical. But search-for actors still do not appear in the second list. :(
 
Your search site is working as it should for me.

As I said: Don't fiddle with the list filters if the lists are displayed via content plugins with filters, hide them.
 
Did you add resetfilters=1 to your content plugins?
Hide the filters with showfilters=0

BTW: You may add
&person_search___ap_person_search_raw={person_search___ap_person_search_raw} to your redirect URL so the form is showing what was selected after the redirect.
 
THAT'S IT - YOU'VE DONE IT!!!
I had tried resetfilters=1 earlier but had taken it out again. Now, with the list filters hidden, it works perfectly.
Adding the extra bit to the redirect URL only worked once though - any further searches were ignored. But that doesn't matter much. I can always add the person's name to the lists.

Thank you so much @troester. You've solved the last major part of my app!
(How do I mark this thread as solved now?)
 
...but just before that, should this work for more than two lists? I was hoping to have four lists but it doesn't seem to be working for the additional two I've just set up. I believe I've set them up in exactly the same way as the first two lists but have exactly the same problem.
 
Hi @troester. I'm frustratingly close to getting this to work.

Following your suggestion in another post, I unpublished all the elements I didn't need in all the lists. It worked for two lists, then three... but not four. Or rather, the fourth list displayed correctly once, but never again. Even though I've got "resetfilters=1" in the content plugin for that list I'm seeing a "sticky" problem when I enable fabrikdebug:
WHERE ( `ap_all_productions_8_repeat`.`ap_person` = '3' AND `ap_all_productions_8_repeat`.`ap_person` = 11 AND `ap_all_productions_8_repeat`.`ap_person` = 3 )
Where '3' is the person I'm searching for and '11' is the person I searched for the first time (when it worked).

Then the third list stopped working too! Then I got an error message on the front end that my session had expired, which is very strange because I was in the front end with Public access to the lists. When I closed down the browser and reopened it, everything was working again. Then it stopped working again beyond list 2 - with no changes to anything.

Any suggestions as to what might be going on with my setup? It's a clean install of J5.0.3 and F4.0 using Astroid template (which work fine on another site using Fabrik) and no third party extensions.

Thanks.
 
Solved! Finally! Just in case anyone has the same problem...
As my four lists were all copies of the same single list which has several joins, I deleted all the joins in the four lists that were not needed. Now it works perfectly.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top