Skip Navigation

[Resolved] Conditional Display

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

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 7 years ago.

Assisted by: Christian Cox.

Author
Posts
#591695

I am trying to: display a conditional field:

<div class="form-group">
<label>Depot Location</label>
[cred_field field='depot-location' post='driving-career' value='' urlparam='' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>

[wpv-conditional if="( $(wpcf-depot-location) eq '1' )"] <div class="form-group">
<label>Gloucester Google Map Coordinates</label>
[cred_field field='gloucester-google-coordinates' post='driving-career' value='' urlparam='' class='form-control' output='bootstrap']
</div>[/wpv-conditional]

Link to a page where the issue can be seen: hidden link

I expected to see: Gloucester co-ordinates displayed if I selected Gloucester from the dropdown

Instead, I got: Gloucester co-ordinates are permanently hidden by my attempt to wrap a conditional in post form hidden link

#591794

Hi, it looks like you're trying to use a wpv-conditional statement to show or hide CRED form sections based on the selections made in other CRED form fields. This won't work as you intend, because conditional values like $(wpcf-depot-location) will not respond to selections made in the current form. They are intended for use outside of CRED forms, to be used in the context of a post, to respond to the post's existing custom field values.

Instead, you should use CRED conditionals:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/

These work differently from wpv-conditional statements and respond to current form selections in other custom fields. Please let me know if that's not clear and I can try to provide some additional guidance.