Forums

Show or hide a field on choice in dropdown CF8

Ron 05 Sep, 2024

Hello

I have a dropdown list that gives choices

example:

       printers=printers

       routers=Routers

Keyboards=Keyboards

  trackpads=Trackpads

I have checkboxes as follows:

      

   -  Printers :  details and image

   -  Routers: Details and image

   -  Keyboards:  Details and image

   -  Trackpads:  Details and image.

The check boxes are hidden and in the dropdown when I choose “ Routers” the check box of Routers should show and when I choose something else the other check box should show and the Routers should be hidden.

I have been able to hide the check boxes but I cannot make it work or show on choice. I am on CF8.  Remaking my forms from CF6.  It is hard work but no other alternative.

Can I get some help?

Thanks

Ronn

Max_admin 10 Sep, 2024
Answer

Hi Ronn

You need to use the Event Triggers and Event Listeners, your dropdown will fire a trigger and your fields will listen for this trigger

A checkboxes group can not show/hide single options, you will need to have multiple checkboxes with the same name and add a listener for each one of them and show/hide each one based on the triggers

You can set the dropdown to fire 2 triggers: hide_all on change, and show_printer...etc for each option

For all checkboxes they should listen to hide_all and hide

Then each one will listen to the specific trigger and show itself

I hope I made it clear but let me know if you still need help

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.