Skip Navigation

[Resolved] Creation a custom field condition based on checkboxes selection

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.

Our next available supporter will start replying to tickets in about 6.67 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Nigel 1 year, 3 months ago.

Assigned support staff: Nigel.

Author
Posts
#1759767

Hi,

I need to create custom fields (for a custom front-end form later on) where I can add Other as an option...

Let me explain: their current Google form that I need to reproduce has a list of checkboxes (where they can select only 3 values) and one of the options is "Other" with a text field to enter the value...

What I would like to do is create a bunch of checkboxes and have a textfield appear IF the checkbox "Other" is selected (and hide otherwise).

So, I created my checkboxes and my text field. When I try to set a condition on the text field, I see the other fields (in basic), but not the checkboxes... So, there seems to be a limit with checkboxes... I then tried the advanced conditions... With the help of the content previously there, here's my second-to-last attempt (previous ones included without the "wpcf-", with and without quotes...):
($(wpcf-primary-high-level-shared-goal) eq 'Other')

Based on that document (https://toolset.com/course-lesson/custom-fields-conditional-display/), I also tried this:
($(wpcf-primary-high-level-shared-goal) = 'Other')

None of them work (P.S. Other is the actual value, not just the label).

So, is there a code I can put there, or it's simply not possible with a list of checkboxes (I tried with drop-downs, radio buttons, etc and it was working fine)? Is there some custom code I can use?

Thank you.

#1760401

Nigel
Supporter

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

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

Screenshot 2020-08-28 at 14.57.35.png

Hi Nelson

I checked, and it seems that checkboxes are simply not supported in the conditional display set on the Types custom fields themselves.

But, it is possible by using Conditional Display Groups in Forms, and from your question it appears that is what you objective is anyway.

See the screenshot where I have a checkboxes field "Checkers" that I use in the test for such a condition in a form, which I tested and can confirm it works.

https://toolset.com/course-lesson/conditional-display-for-form-inputs/

#1760417

Great! I'll try that when I'll create my form...

But, from what I understand, it also means that people that use the front-end form will be able to add "Other" content, but people (ex: administrators) won't be able to do so in the back-end (unless I let the "Other" text field always visible)?

Thank you,
Nelson

#1760419

Nigel
Supporter

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

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

Correct.

There is no way to hide the extra text field based upon the checkboxes field in the backend.