Home › Toolset Professional Support › [Resolved] Checkbutton to hide / show custom field
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 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Types plugin
This topic contains 8 replies, has 2 voices.
Last updated by samuelH 5 years, 2 months ago.
Assisted by: Shane.
Hi,
Is there a way to make a checkbutton to hide / show a custom field without using Set conditions and Data depentent display?
I am trying to let the user check yes if they like to comment. Then the comment field displays underneath.
hidden link
Choosing "Ikke relevant" (image) does this, but it´s a lot of coding just to show that custom field. I have 33 forms, with 50 custom fields on each - therefor looking for a simple show / hide function to integrate in forms.
Hi Samuel,
Thank you for getting in touch.
A condition to display or not display a field will always require a some data dependent field such as the checkbox you mentioned.
It is possible to create a checkbox to show/hide a field. So if the user checks yes the field displays and if they uncheck it, then the field doesn't display.
Could you let me know where you are using this so that I can best advise?
Thanks,
Shane
Hi Shane,
This show / hide will be used on forms like this: hidden link and this hidden link
The forms are almost identical, only different questions...
This shows wehat I would like to happen: hidden link
Fourth choice in drop down field displays the field underneath. (NB: This is just a test, and the drop down should be another checkbox)
So I am able to make this work, but again - if there is a easier way that would be fantastic. Using the test method I have to make changes to so many thing.
So is it possible to make a button, a checkbox or similar that simply reveals a hidden custom field? NB: Multiple instances on each form
Thank you so much for not giving up on me!
Hi Samuel,
I'm assuming this conditional was added to the form itself or through our types backend.
The method is the exact same to add a conditional that is dependent on a checkbox. So all you need to do is create a checkbox with the appropriate values and then setup the conditional for your text field based on that.
Please let me know
Thanks,
Shane
Hi Shane,
Thank you for following up on me. Just to make sure I understand this correctly, one last question:
I am actually just looking for a way to hide and show a custom field, regardless of dependency to the button that makes the field hide / show.
It´s more like an offer to the guest. If the guest would like to leave a comment they should be able to click a button or a checkbox. Then the custom field displays.
Maybe I am asking for som kind of accordian, I am not sure. I hope I was able to explain what I am trying to achive.
Hi Samuel,
Ok thank you for the clarity. So its not that you would like it to be field dependent but you want it to be hidden.
In this case you will need to enable bootstrap on your site by going to Toolset -> Settings -> Bootstrap loading and let the plugin load bootstrap 3 if its not already doing so.
Then you will need to use the expert editor for your forms and add the accordion around your field.
You can use the example below to craft your accordion to be able to add your field to it.
hidden link
Please let me know if this helps.
Thanks,
Shane
Hi,
The accordion approach is not what I am looking for. I have made a image to show how I would like it to work.
It may be a button or a checkbox. When clicked a text input field displays underneath the row.
Hi Samuel,
The checkbox method is as I described here
https://toolset.com/forums/topic/checkbutton-to-hide-show-custom-field/#post-1361367
So you can create a checkbox that this field will be dependent on that will be labelled "Would you like to leave a comment?".
If the user checks the checkbox then the comment box will be open, but it will be hidden until the user checks the checkbox.
Are you aware of how to setup the conditionals for the fields ?
I hope this clears things up a bit for you.
Thanks,
Shane
My issue is resolved now. Thank you!