Skip Navigation

[Resolved] Checkbox logic in post edit mode does not work on a updated post

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

Problem:
How can I hide a Types Field, and show it only if a specific Types Checkbox field is checked?

Solution:
1. Create your Field you want to hide
2. Create a Types Checbox Field (leave all settings default)
3. Save the Field group
4. Head to the Field you want to hide and edit it
5. Add a Conditional display with the GUI
6. Choose to show this field only if the checkbox field is value=1

This will now show that field in the Post Edit screen only if you check the Checkbox Field

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

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by Simon 7 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#413232
checkbox_wp_types_3.png
checkbox_wp_types_2.png
checkbox_wp_types.png

Hello,

I have a date field which is shown in post edit when a checkbox is checked (value = 1, see attached image).

* If I edit a new post this logic is working and the date field is shown when the checkbox (event-several-dates) is checked (see attached image).

* If I edit a post that has been posted and not have the several dates checkbox checked (value = 0 ) and check this box (value = 1) the date field is not shown. I wish to see the date field as in the step above,

Best regards,
Simon

#413242

Yes, I confirm this issue.
You need to go one step further and save the (editing) Post with the Checkbox Checked and then, the Date Will show.
But it does not show/hide with AJAX on the fly as it does when you create a new Post.

It is related to the "save 0 to the database" issue.
When you check that option, our Fields, unfortunately behave a bit unexpected, and we are working on this.

A simple solution to your problem is to use the native/default "don't save anything to the database" option.

Your Logic will still work, and the AJAX will work as expected.

I reported this issue to the 2nd Tier (actually, there are already a few problems with the "0" value)

#413243

Thank you very much for the fast reply Beda!

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