1 Reply Latest reply on Sep 20, 2012 5:50 PM by Ed79BA

    Using checkbox to show/hide items in a form

    ahlaj77 Level 1

      Form.jpg

      Newbie to livecycle. I have a Livecycle form that has three sections on it. On the top section I have a checkbox that says Show/Hide. When I click the checkbox I would like for the items under section titled "Cover Required" to be rolled up and hidden while the other sections below it move up. How can I make this work? Also I wanted to attach the form to this forum, but not sure how to do that. Thanks!

        • 1. Re: Using checkbox to show/hide items in a form
          Ed79BA

          Hi,

           

          Your 'cover required' section you want to hide will probably be realised as a subform that contains other (possibly nested) subforms. To 'roll up' this subform you need to set it as 'hidden' dependent on the selection of your checkbox. Just a view hints on possible implementations of this behavious.

           

          1 Create a reference to your subform. The code could look something like:

          var myCoverReqSubform = xfa.resolveNode("rootSubForm.CoverRequiredSubform"); //either absolute (from root form) or relative path to your                                                                                                                              // subform is required to resolve the subform.

          .......

           

          2 Set your subform as hidden when the checkbox is selected. This can be done in a change event of the form:

            .....

            <event activity="change" name="event__change">

               <script contentType="application/x-javascript">

                var myCoverReqSubform = xfa.resolveNode("rootSubForm.CoverRequiredSubform");

                 if (checkbox.rawValue == 1) {

                    myCoverReqSubform.item(i).presence = 'hidden';

               }

               </script>

            </event>

           

          You can find further implementation details on various other posts in this forum, this is only to get you started.

          Hope that helps.

           

          Regards