Skip Navigation

[Resolved] I can't get wp-conditional to work in CRED form

This support ticket is created 7 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by jeffS-2 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#560132

I am trying to: display a form field based on another field using wp-conditional.

Link to a page where the issue can be seen: (Requires login)

I expected to see: The conditional form field "IEEE Number" appear when the dependent (select) option is set to "Member".

Instead, I got: The IEEE Number field is not displayed.

My CRED form conditional code:

[wpv-conditional if="( $(wpcf-nma-ieee-member-level) eq 'Member' )" debug="true"]
	<div class="form-group">
		<label>IEEE Number</label>
		[cred_field field='nma-ieee-number' post='new-membership-form' value='' urlparam='' class='form-control' output='bootstrap']
	</div>
[/wpv-conditional]

Result with CRED Debug enabled:

('Member' option is Selected in dependent IEEE Member (Level) field )

####################
wpv-conditional attributes
####################
Array
(
[if] => ( $(wpcf-nma-ieee-member-level) = 'Member' )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( $(wpcf-nma-ieee-member-level) = 'Member' )
--------------------
--------------------
Converted expression: ( '' = 'Member' )
--------------------

END

#560203

Dear Jeff,

The [wpv-conditional] works when the custom field have been saved into database, it works in the server side, if you are using CRED form for creating post, please follow our document to setup it:
Advanced Conditional Display for Form Sections
https://toolset.com/documentation/user-guides/cred-conditional-display-engine/

#560211

Luo - Thank you for your solution. It works correctly.

However, please be aware that, in a standard CRED form, the "Conditional Output" button creates code using the [wpv-conditional]. This seems to be misleading to me. I understand how that button could be useful but, if a developer is editing a CRED form post and wants to show/hide a field based on another field in the same form, there should be a button for that as well. In fact, I think there did used to be such a button in CRED but, it seems to be missing now.

Cheers,
Jeff Safire