Skip Navigation

[Resolved] Required custom fields using conditional display

This support ticket is created 6 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#599444
Capture.JPG

I have a post type with numerous post field groups, each of which only display under certain conditions. Some of these conditional display fields are required (if the conditions to display the field group they're in are met). This doesn't cause any problems when I'm editing the posts themselves. However, when I edit a post (of a different post type) that has these posts as children, the display of post children at the bottom includes *every* possible custom field for the child posts, including the ones that should be suppressed by the conditional display.

See the attached screenshot for an example (you can access this page at: hidden link -- you have my permission to log in and make any modifications needed using the username and password I set up for Toolset support in the previous thread.)

The fields "Question 1" and "Question 2" are part of the Maryland Legislature field group -- which is only supposed to display when a Candidate post has "md-leg" as the value for its Office field. (backend link here: hidden link) Those fields don't show up when I'm editing the Candidate posts themselves, but when I edit a Questionnaire post, which has each of those candidates as a child, the display of children includes those fields. That means I can't make any changes to the Questionnaire post type, because it won't let me save them without filling out the "required" fields that aren't being suppressed by conditional display.

Let me know if you have any questions -- I understand that the latest Toolset release made some improvements to conditional display of post fields from my last support thread: https://toolset.com/forums/topic/page-content-type-is-broken-corrupted/

Thanks!

#599618

I confirm that if you have a Custom Post Field, displaying conditionally related to another Custom Post Field, in a single Post edit screen all works fine.

You will fill the field "Trigger" with the right value and then the Field "Shown conditionally" will show as soon you click outside the just edited field.

When the same 2 fields are present in the Child Post Table within a parent post edit screen, the situation is different, for several reasons.

There is a table, and we cannot hide the entire Table column (there might be fields that conditionally should show and others not) That is why you will see the column itself always, no matter what.

Now, testing this with a simple field, I do not see the field that should be hidden in the Child's post table. I see just the column, but not the field, as long it should be hidden.

Every thing works exactly as expected in my tests, even the requirement of the field is not presenting any issue.

Now, you shared some links to the backend inviting me to log in, but I miss the log in details.

Now, I confirm that hiding an entire group by conditions of fields in another group, fails in that edit Child Post Table.

But this is also expected, due to the same exact reason as above.

You cannot hide all the column's content for that field group (there might be some that need to be shown)

Hence Types simply handles only field-depends-on-field conditionals here, not group-depends-on-field conditionals.

You can set conditional to hide single fields only, but not the entire group, in that Child Post edit table. Eventually this image will clarify this: hidden link

In case this does work differently on your install, please let me know.

Also - the entire post relationship is revamped and I need to consult with the Developers how much will be changed in that child post table (its a lot) - it could be that the issue will not even be replicable anymore as soon the new many to many relationship features are released stable, because the entire GUI changed.

#600027

Hi Christian --

I'm a bit confused by your reply -- I'm using conditional display for the field group, and that's what's causing the problem. Are you saying I need to set conditional display individually on each question, in addition to on the group?

As a stopgap, is there any way I can stop the table of child posts from showing up entirely on this post type? So that I'm still able to edit the Questionnaire items without getting an error.

Here's the post field, you can see that I've set conditional output on the group level: hidden link

How can I securely give you login credentials?

#600050

Sorry for the confusion, let me try to clarify.
Are you saying I need to set conditional display individually on each question, in addition to on the group?
Yes, that is one way to address this problem and get around the error messages you're seeing. It's a bit tedious but effective.

As a stopgap, is there any way I can stop the table of child posts from showing up entirely on this post type? So that I'm still able to edit the Questionnaire items without getting an error.
There's not a good way to suppress this table, however from the Questionnaire dashboard, you may be able to use the "Quick Edit" feature to edit the post without triggering the child post validation. Hover over the Questionnaire link and you'll see the option appear beneath it. Some elements in the post can be edited from here.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.