Skip Navigation

[Resolved] Unable to use conditional in CRED form

This support ticket is created 2 years, 9 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by himanshuS 2 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2302579

I am unable to use conditional to show a field based on another field.

What could I be doing wrong?

Field to check is a radio field -
1. Aspiring Product Manager
2. Experienced Product Manager

When I check it using this it does not show-

[cred_show_group if="( $(career-stage) eq '1' )" mode="none"]
	<div class="form-group target-industries">
				<label class="field-title">[cred_i18n name='timeline-aspiring-pm-label']What is Your <b class="home-v2-header-accent">Timeline</b>?[/cred_i18n]</label>
      [cred_field field="timeline-aspiring-pm" force_type="field" class="form-control" output="bootstrap"]
	</div>
[/cred_show_group]
[cred_show_group if="( $(career-stage) eq 'Experienced Product Manager' )"]
<div class="form-group target-industries">
		<label class="field-title">[cred_i18n name='timeline-experienced-pm-label']What is Your <b class="home-v2-header-accent">Timeline</b>?[/cred_i18n]</label>
      [cred_field field="timeline-experienced-pm" force_type="field" class="form-control" output="bootstrap"]
	</div>
[/cred_show_group]

I ahev tried the version where [cred_show_group if="( $(career-stage) eq '1' )" mode="none"] is replaced with
[cred_show_group if="( $(career-stage) eq 'Aspring Product Manager' )" mode="none"]

Both don't work.
The field setup is here - hidden link

#2302759

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I just run a test with radio field and its just working fine.

I would like to know, have you added post field conditional display with your custom field group as well that is used to display fields conditionally on admin post add/edit page?

#2302769

The fields I am working on are user fields and there is no conditional group for them at custom group level.

#2302959

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've ran a test with radio custom field on User form and added the conditional display with form based on radio option but I can see it working as expected. Please check the following video: hidden link

Can you please share problem URL and admin access details and let me check whats going wrong with your setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2303359

Minesh,

I was able to figure out the issue. I need to have the conditional field listed in the form for the condition to work. The conditional does not pull the value from DB.

I have a follow up. I want to create multiple conditions so that field if visible when one fo the two fields are not empty. I am trying to use this logic but it does not work. What could I be missing -

[cred_show_group if="( $(timeline-aspiring-pm) ne 'Empty' ) OR ( $(timeline-experienced-pm) ne 'Empty' )" mode="none"]
<span class="change-later-text">Great! We will help you get your dream job. But, first we need to identify your target skills so that we can match you with the right jobs.</span>
<br>
[/cred_show_group]
#2304867

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The not empty condition should be as given under:

[cred_show_group if="( $(timeline-aspiring-pm) ne '' ) OR ( $(timeline-experienced-pm) ne '' )" mode="none"]
<span class="change-later-text">Great! We will help you get your dream job. But, first we need to identify your target skills so that we can match you with the right jobs.</span>
<br>
[/cred_show_group]
#2305133

My issue is resolved now. Thank you!