TOPIC:

Turning off BF sections when fields not editable 8 years 11 months ago #69030

  • Topic Author
  • JinaLabina
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 16
  • Thanks: 0
When all fields of a BF section are not editable by a given CB view, the rendered BF still shows the section header but with an empty body. Is there a way to turn off the section automatically in this case so it does not show up in the rendered BF?

Please Log in or Create an account to join the conversation.

Re: Turning off BF sections when fields not editable 8 years 11 months ago #69120

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
Hi,

unfortunately not by default due to performance issues that I see that could appear on the site.
But you can add this as workaround:

Go to form => advanced => scripts => initialization script => click custom => add the following code and replace FORMNAME, by the name of your form. Also add all fieldnames in the list that are included in the section that should disappear and enter the name of the section:
function ff_FORMNAME_init()
{
    var section_name = 'mysection';
    var fields       = ['fieldname1','fieldname2','fieldname3'];

    // do not change anything from here

    var fields_count = 0;
    var fields_in_section = fields;

    for( var x in bfDeactivateField ) {
        if( JQuery.inArray(x.replace('ff_nm_','').replace('[]',''), fields_in_section) != -1 ){
          fields_count++;
        }
    }

    if( fields_count != 0 ) {
       JQuery('#'+section_name).css('display', 'none');
    }
}

This should turn off the desired section if all of the fields inside are off on form load.

Regards,
Markus
The following user(s) said Thank You: JinaLabina

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.042 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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 sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!