Accordion don't works

Hello from island réunion (indian Océan)
Applogize for my english please.

Using Form Designer 3.1.4 (waiting my IT service to upgrade) & SHP 2016
newbee, i read topics about managing accordion but it don't works in my simple case.

i copy the @shedev solution but it don't works .

  • i want to open accordeon only if 'categorie' field = 'correction de la demande' and if it's possible make the field 'article' obligatory
  • i paste the code below in the javascript editor but nothing is hapening. ? i certainly made somethong wrong but i don't find since a week of research !!

Thanks for your help / Francois

fd.spRendered(function() {

function showHideAccordion() {
    if (fd.field('Cat_x00e9_gorie').value == 'Correction') {
        // Enable the First Tab
        fd.container('Accordion0').$children[0].disabled = false;
		//Open the First Tab
		fd.container('Accordion0').$children[0].open = true;
    } else {
        // Disable the First Tab
        fd.container('Accordion0').$children[0].disabled = true;
		//Close the First Tab
		fd.container('Accordion0').$children[0].open = false;
    }
}

// Calling showHideAccordion when the user changes the field
fd.field('Cat_x00e9_gorie').$on('change',showHideAccordion);

// Calling showHideAccordion on form loading
showHideAccordion();

});

Dear @Francois,
This is code for Plumsail Forms for SharePoint Online and SharePoint 2019 Modern UI, it will not work with the classic Forms Designer tool. It has no events such as fd.spRendered() and many features work differently.

Instead, you can find out how to disable tabs in Tab control in Forms Designer here - How to create dynamic forms with Forms Designer in SharePoint 2010 - SharePoint Forms Designer

Unfortunately, Accordion doesn't allow to disable sections like this, but instead, you can follow the guide and hide sections based on their index, like this:

// hide
$('#fd_accordion-0 > h3').eq(0).hide();
$('#fd_accordion-0 > div').eq(0).hide();

// show
$('#fd_accordion-0 > h3').eq(0).show();
$('#fd_accordion-0 > div').eq(0).show();