Skip Navigation

[Resolved] Correct syntax for Form Conditional Display

This support ticket is created 4 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by collectiveU 4 years, 5 months ago.

Assisted by: Raja Mohammed.

Author
Posts
#1838429
form.png

As per attached, we've got a custom field in a post from that we are dynamically populating based on user selection.
In this form, we're using the select field values to derive the next drop-down list etc.

On this post form though, we are wanting to implement a conditional field display based on the selected value.
What is the correct syntax to use as described in https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/ where we want to use the RIGHT function.

The below use of RIGHT function does not seem to work:

  [cred_show_group if="RIGHT($(social-nine-hole-round),1) eq '0'" mode="fade-slide"]
  <label>xyz</label>
  [cred_field field="social-daily-handicap" force_type="field" readonly="true" class="form-control" output="bootstrap"]
  [/cred_show_group]
#1838663

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

BIoaM7dOVI.gif

I just tried this on my own site and it worked.

I have a select custom field ("selection") with options where the saved value is a number from 1 to 13.

I added a conditional display group to a form dependent on this custom field, so that if the last digit was 2 then it should display the inner content. You can see it working in the gif, where Ta da! shows when I select either Option title 2 or Option title 12.

Here's how I generated that result:

	[cred_show_group if="( RIGHT($(selection),1) eq '2' )" mode="fade-slide"]
	<p>Ta da!</p>
	[/cred_show_group]
#1838701

My issue is resolved now. Thank you!
The problem wasn't how I was using the RIGHT function. It was because I had a custom field of social-nine-hole-round as well as a generic cred field which was clashing.