Skip Navigation

[Resolved] How to conditionally display groups of fields in backend as well as frontend

This thread is resolved. Here is a description of the problem and solution.

Problem:
Client has a front-end form which uses cred_show_group to conditionally display a group of fields depending on the value of another field, and would like the same on the backend post edit screen.

Solution:
Individual Types fields can be conditionally displayed on post edit screens (which is also inherited in frontend Forms) based upon the value of another field. To conditionally display a group of fields simply apply the same rule to each of the fields.

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/
https://toolset.com/documentation/user-guides/types-custom-fields-conditional-display/

This support ticket is created 5 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Dee_DeeA2948 5 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#1188824

#2. Scenario: I'm using conditional logic to display certain fields based on a dropdown value. For example,
If "alphabet" field value is ABC, then show fields 1-5.
If "alphabet" field value is DEF, then show fields 1-10.
If "alphabet" field value is GHI, then show fields 1-15.

Using my example, if the "alphabet" field value is ABC, the user will ONLY see fields 1-5 and be REQUIRED to answer questions 1-5.
This works on the front-end as expected. But, if I try to publish the post from wordpress (after approving), it requires all 15 fields. I'm not sure if I'm doing something wrong?

Thank you, again for your help.

#1189096

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-01-22 at 15.44.18.png

For this to work the same way in the back-end post edit screens as in front-end forms, you need to set up both the required-ness and conditional visibility in the settings for the custom fields.

You can remove the conditional display you have set up in your form.

Edit the fields. You have already set them all to required.

Add conditions for their display (as per my screenshot).

According to your example, each of fields 1-5 would depend on the alphabet field having a value of ABC.

These conditions will apply both to the front end and back end.

The "required" attribute will only be applied to visible fields.

#1191632

My issue is resolved now. Thank you!