Skip Navigation

[Resolved] change from toolset views to blocks broke conditional search

This support ticket is created 3 years, 10 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: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by GamX 3 years, 10 months ago.

Assisted by: Jamal.

Author
Posts
#2031269

Hello, I just upgraded to Toolset Blocks to replace Views. I am using a lot of conditional blocks that check whether a form has been submitted or not via wpv-search-term parameter. One condition is before form submittal, and another condition is after form submittal. Each condition displays different content. I am using the Advanced Editor as I am also checking for user field values.

Both of these conditional blocks worked properly prior to switching to the Toolset Blocks plugin. However, now the search term statements do not work. Previously I had used = or != which both worked. But after the upgrade to Blocks they converted to EQ and NE. I tried editing them back, but neither way works now. I now get an "incomplete condition" error in the block editing view when using any of the following statements...

Condition to show content if user has NOT yet submitted a form on the page:
( '[wpv-search-term ]' = '' )
( '[wpv-search-term ]' EQ '' )

Condition to show content if user has submitted a form on the page:
( '[wpv-search-term ]' != '' )
( '[wpv-search-term ]' NE '' )

Please tell me the correct syntax to use inside the conditional Toolset Blocks in the Advanced Editor. Thank you!

#2031857

Hello and thank you for contacting the Toolset support.

I am not used to EQ and NE in capital letters, but I would expect to have "eq" and "ne". Maybe the issue is because the wpv-search-term has lost its param attribute. For example, assuming the parameter URL is "client_id"

( '[wpv-search-term param="client_id" ]' eq '' )

If that's not the case, I'll need to take a closer look at these conditions to further investigate. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2032985

As I explained in my last reply, the wpv-search-term shortcode needs an attribute to check against. If no parameter is provided it will check against the default WordPress search parameter "s". Exemple:
hidden link
Read more about the shortcode here https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-214940

I submitted the form to check what are the URL parameters that will be added on success and it gives:
hidden link
Which means that the following shortcodes:

[wpv-search-term param="_tt" ]

[wpv-search-term param="_success" ]

[wpv-search-term param="_target" ]

Will return:

1619432028
9100_1
33

So, You can update the conditions to:

  ( ( '[wpv-search-term  param="_success"]' eq '' ) ) 
And
  ( ( '[wpv-search-term  param="_success"]' ne '' ) ) 

I tested it on that page and it seems to work. Check this screenshot hidden link

#2033309

Wow thank you, Jamal! That was totally the problem. You are right - I didn't realize that the "success" portion of the statement had been stripped out after the update. With these corrections the functionality works as expected. Thank you!

Now two problems remain, which won’t hinder my progress but still need to be addressed - I’m hoping you can report these to your colleagues…

1. As a result of either or both the WordPress and Toolset Blocks update, all of my conditional statements that I used in the conditional blocks had a portion stripped out: param="_success"

BEFORE THE TOOLSET BLOCKS INSTALL (previously using Toolset Views):
( '[wpv-search-term param="_success"]' = '' )
( '[wpv-search-term param="_success"]' != '' )

AFTER THE TOOLESET BLOCKS INSTALL:
( '[wpv-search-term ]' eq '' )
( '[wpv-search-term ]' ne '' )

Weirdly blank spaces were there instead of the param="_success" portion of the statement. And although the = changed to eq and != to ne, this change didn't seem to cause an issue.

2. Less important but still an issue when troubleshooting is that even when I correct these statements to include param="_success" ... there is still an error statement in the RH column regarding the Toolset Conditional block: "Incomplete condition"

So now, I have to back and fix all of my pages because param="_success" was stripped out of ALL my toolset conditional blocks. On the plus side, thanks to you, I now have a solution that will make it work, but please report the above remaining issues to your colleagues.

And thank you again!!!

#2033311

My issue is resolved now. Thank you!

#2034425

Hello, just wanted to confirm that the persisting error message doesn't reflect some underlying issue... please let me know. Appears to render correctly when I view on the front-end, but at least is still a problem when troubleshooting conditions. Thank you!