3 Replies Latest reply on Apr 11, 2012 12:25 PM by Jenn Andrews

    Subform Instance Controls: Add Button

    NikDK Level 1

      Hello,

       

      I have a subform that i want to continue repeating when the user clicks on the add button. I would like the minimum to be 0 and when the user clicks on the button it will bring up the first occurrence. The problem is that it is not allowing me to have a minimum of 0, only 1. if i change it to 0 then the subform does not appear when clicking the add button.

       

      Also, i keep getting an error message when clicking the add button. it says "Date of birth: the birth date must be entered". the message appears about 5 times. I have made the date of birth field in the subform 'optional' as it was previously mandatory, and i have confirmed that there is no other script causing the problem, so im not sure why it isnt working.

       

      I would greatly appreciate any help that is offered.

       

      Thank you in advance!

       

      Nik

        • 1. Re: Subform Instance Controls: Add Button
          NikDK Level 1

          Ok, I answered part of my question. I found out why I was getting error messaes.

           

          I would still like to know however, how i can have a minimum of 0. Does anyone know if this is possible?

           

          thank you

          • 2. Re: Subform Instance Controls: Add Button
            $Nith$ Level 4

            Another approach:

             

            1. Kee the minimum instance as 1 but hide the 1st row.

             

            2. Upon clickin the add button add a new instance and set the presence property to 'visible'

             

            var newRow = Table1._Row1.addInstance(1);

             

            newRow.presence = 'visible'

            Nith

            • 3. Re: Subform Instance Controls: Add Button
              Jenn Andrews

              Yes, you can have a subform with its occurrence set as 0 and then added when a user clicks an add button.

               

              In a simple form I have a button with the following script _Subform1.addInstance();

               

              There is a subform named SubForm1 that exists and has on the binding tab of the object Repeat Subform for Each Data Item "checked"

               

              The min, max and initial count are not selected.    This will have it that when the form is rendered there is no instance of 'Subform1' and that when the add button is pressed then 'Subform1' is added once.

              1 person found this helpful