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
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/
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