1
0
-1

Can collapsible sections be expanded when a button in the previous section is pressed?

I have tried adding an on Click rule using scrollTo but this doesn't seem to trigger the expanding.

Cheers, 

Dan.


    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Dan,

      You can use this code to get JQuery to click the button... just replace 'sectionnew' with the id of your section:  

      setTimeout(function() {
        $('.id-sectionnew .wdg-section-2-collapse-button')[0].click();
      })

      1. Dan Cormick

        Thanks Bill. I'm finding my feet with this so hoping you can clarify a little more:

        1. Does this code go in the Click rule?
        2. Does it need to reference the id of the collapse chevron or is the section id that the collapse setting is applied to correct?

        I have 

        $('.id-contactDetails.wdg-section-2-collapse-button')[0].click()

        in the Click Rule

        and get this error in the console:


        TypeError: Cannot read property 'click' of undefined at Rules.click_next (<anonymous>:1244:57) at fn (eval at compile (:794:126), <anonymous>:4:666) at b (<anonymous>:685:128) at e (<anonymous>:839:195) at m.$eval (<anonymous>:704:293) at m.$apply (<anonymous>:705:17) at HTMLButtonElement.<anonymous> (<anonymous>:839:247) at HTMLButtonElement.dispatch (<anonymous>:5:10316) at HTMLButtonElement.q.handle (<anonymous>:5:8343)


        (anonymous)@VM16511:677

        (anonymous)@VM16511:649

        $apply@VM16511:705

        (anonymous)@VM16511:839

        dispatch@VM16511:5

        q.handle@VM16511:5
      2. Bill Frost

        Hi Dan,

        The section name should be the ID of the section itself.  I called my test section 'SectionNew' and it created an id of 'sectionnew'.  I put my code in a click rule of a Button I added to the form.

        You'll need your code wrapped in a setTimeout call:

        setTimeout(function() {
          $('.id-sectionnew .wdg-section-2-collapse-button')[0].click();
        })

        ...and you'll need to make sure there is a space before '.wdg-section-2-collapse-button' in the JQuery selector.


      3. Dan Cormick

        Hi Bill,

        I don't appear to have the Field Reference ID in the Data panel. Is this a permissions restricted feature?

        Thanks for your help.

        Cheers,

        Dan.

      4. Bill Frost

        Hi Dan,

        If you're using a newer release than my 5.1.3.4, you'll find the ID at the top of the Properties panel now.

      5. Dan Cormick

        Got it! Working as desired. Thanks very much.

      CommentAdd your comment...