Skip Navigation

[Resolved] wpf-if fails on types fields which contain single quotes or apsotraphes

This support ticket is created 8 years, 5 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
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 4 replies, has 3 voices.

Last updated by Adriano 8 years, 4 months ago.

Assisted by: Adriano.

Author
Posts
#350306

Ben

I am trying to: In a NESTED View, Im trying to see if a field is NOT EMPTY, and return results if TRUE

I expected to see: Output

Instead, I got: No output

In my view I am doing the following in my NESTED View:

[code]
<wpv-loop>
[wpv-if evaluate="'[types field='venue-name' id='$venue'][/types]' != ''"]
….. DO STUFF
[/wpv-if]
</wpv-loop>
[/code]

In some cases the venue-name has a single quote, or apostrophe and this will cause the evaluation to fail.
i.e. if the venue name = "Jonathan's Cafe"

At the moment Im now testing against a field that is less likely to contain an apostrophe, BUT this is not ideal as this field could be empty, where as the venue should always have a name.

I believe this is because in a nested situation quotes entities are not being encoded properly? I do not believe that this was an issue before, so perhaps this is a regression with the last update.

I HAVE ALREADY:
- Turned off all other plugins, and switched themes. We are up to date with Types (1.8.10) and Views (1.11.1).

#350419

Dear Ben,

Thanks for the feedback, I have been able to duplicate same problem with Views shortcode [wpv-if] and [wpv-conditional], and put it into our to-do list our developers will take care of it.

#351199

Hello,

I'm Adriano, Toolset support lead. Our evaluating shortcode passed by changes, the wpv-if has been discontinued (kept for backward compatibility) and replaced by the wpv-conditional. Unfortunately the new one doesn't let you compare info from parent and that's one thing I'll report to the dev team as feature request, thank you for bringing this up.

#351787

Ben

Luoy, Adriano,

Thanks for the feedback. Please do pass this along to the dev team, as many of my views use conditional logic to query parents and sometimes children, so Im unsure how to upgrade these views.

Thankfully this seems to work in many cases:
[code]
[wpv-conditional if="$(wpcf-booking-note)"] ... do stuff [/wpv-conditional]
[/code]

Regardless [wpv-if] and [wpv-conditional] both fail when the field contains an apostrophe bug when comparing against != ''" and I believe when using !empty as well. Perhaps there is some common code between them that can address the issue in both the apis.

QUESTIONS:
I'll be looking to upgrade all the logic in our views to the new [wpv-conditional] logic over time, as a path become clear. Is there any scheduled version number when the [wpv-if] api will be depreciated?

#352125

Do not worry, the wpv-if won't be removed, just discontinued. The best thing is to start using wpv-conditional because new features will be added only there. I understand that you need the feature above in order to move it forward but unfortunately I don't have any ETA for this yet.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.