Show/Hide an element in view if a checkbox is or isn't chosen

  • witchypaws
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 26
  • Thank you received: 0

witchypaws created the topic: Show/Hide an element in view if a checkbox is or isn't chosen

Hi Guys

I have six fields, the fields 2-6 only shows in the form if the first field has a value ticked for each of the following fields

I would like to create a content builder view that shows the results of fields 2-6 only if they were chosen in field 1

i.e. field 1 (checkboxes, multiple items allowed) can be individuals, teams, organisations, business, government

If they tick individuals and government, then they are asked to fill out further options in dropdown multiple checkbox fields for those two categories

On the profile, we only want to show the results for the individuals and government fields if they were ticked in field 1 but hide if they were not chosen

i.e. the profile can look like this

Directors, Entrepreneurs, Executives, Founders, Support staff

Boards, Committees, Executive, Leadership, Support

Membership Associations, Non-profit Organisations, Peak Bodies, Purpose Driven Organisations, Schools, Social Enterprises

Conscious Business, Contracted Agencies, Family Business, Non-profit Business, Purpose Driven Business, Small Business, Start-ups


but in this case we only want it to look like this as they only ticked individuals and government in field 1

Directors, Entrepreneurs, Executives, Founders, Support staff


I understand how to show or hide field based on if it is empty or not but not quite sure the best way to do this as I don't know the syntax to show a field based on the value chosen in another field

Can you assist please


  • Posts: 3107
  • Karma: 104
  • Thank you received: 407

mihaela replied the topic: Show/Hide an element in view if a checkbox is or isn't chosen


If you have one Checkbox group element containing options "individuals, teams, organisations, business, government", then to show/hide fields based on selected checkbox options you need to use JavaScript visibility rules.

Please take a look at this piece of documentation regarding JavaScript visibility rules .

Here is a code for your example:
function ff_checkboxgroupname_action(element, action)
    var ind = 0; 
    var tm= 0; 
    var org = 0; 
for (var o = 0; o < opts.length; o++) {
    if(opts[o].value == "individuals") {
          ind = 1;
    if(opts[o].value == "teams") {
          tm = 1;
    if(opts[o].value == "organisations") {
          org = 1;

if(ind == 0) { bfToggleFields('off','element','individuals',bfDeactivateField); }
if(tm == 0) { bfToggleFields('off','element','teams',bfDeactivateField); }
if(org == 0) { bfToggleFields('off','element','organisations',bfDeactivateField); }

} // ff_checkboxgroupname_action
In this code it is assumed that you have fields named "individuals", "teams" and "organisations" which are displayed in case the corresponding checkboxes are checked.

As for the view, when a certain record is entered in the Content Template by default only fields that were filled in that record will be shown.

Let me know whether you have managed to set this for your form.


Moderators: ForumSupporttomeperica
Time to create page: 0.060 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here