Skip Navigation

[Resolved] conditions on radio field do not work in a form

This support ticket is created 3 years, 11 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 – 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: Africa/Casablanca (GMT+01:00)

Author
Posts
#1887865

Thank you for the explanation. I am trying to make two status fields. Status 1 (pending, approved, decline). Status 2 ( borrowed, returned). In the beginning status 1 filed will be shown. When status 1 changed to approved, status 2 will be shown. I tried to use below condition but it is not working. Please let me know how to make it work.

[wpv-conditional if="($(enginvrequests-status-1) eq 'Pending')" mode="fade-slide"]

[cred_field field='enginvrequests-status-1' post='enginvrequest' value='' urlparam=''] [/wpv-conditional]
[wpv-conditional if="($(enginvrequests-status-1) ne 'Pending')" mode="fade-slide"]

[cred_field field='enginvrequests-status-2' post='enginvrequest' value='' urlparam=''] [/wpv-conditional]

#1887867

You need to use the cred_show_group shortcode for the condition instead of wpv-conditional and make sure to use the value of the field instead of the label. Check this screenshot hidden link

I created a test site and run a small test on it to show you how. You can login here hidden link
- Custom fields are defined here hidden link
- The form is built here hidden link
- The form is displayed here hidden link

I hope this helps. Let me know if you have any questions.

#1888245

Thank you. In the test site I can see that the status 1 will still be shown when status 2 is shown. In my case I want to hide status 1 when the status changed from pending to approved. Then only status 2 will be shown. Is this possible?

#1888611

Yes, It is possible. You need to wrap the "Status 1" inside a cred_show_group and set it to display when its value is different than "approved". Once it is approved, it should be hidden.

Then you need to update the condition on "Status 2" to display for both values of "Status 1" (pending and approved). Or when the value of "Status 1" is different than "decline":

	[cred_show_group if="( $(status-1) ne 'approved' )" mode="fade-slide"]
	<div class="form-group">
		<label>[cred_i18n name='status-1-label']Status-1[/cred_i18n]</label>
		[cred_field field='status-1' force_type='field' class='form-control' output='bootstrap']
	</div>[/cred_show_group]
	[cred_show_group if="( ( $(status-1) eq 'pending' ) OR ( $(status-1) eq 'approved' ) )" mode="fade-slide"]
	<div class="form-group">
		<label>[cred_i18n name='status-2-label']Status 2[/cred_i18n]</label>
		[cred_field field='status-2' force_type='field' class='form-control' output='bootstrap']
	</div>[/cred_show_group]