3 Replies Latest reply on Dec 22, 2011 2:57 PM by MarkWalsh

    Need multiple drop down menus to populate text in one text box

    govtech77 Level 1

      Not sure how to do this. I have 27 drop down boxes with the choice of true or false. What I need is that everytime someone chooses false it will create a list of subjects that were false at the end of the document in the notes section.

      I tried a simple false export value and on blur - run a java script 'this.getField('NOTES: Resource concerns').value = event.value;', but it will replace the previous drop down boxes subject. Is there a way for me to get multiple lines included in the notes section?

       

      Thank you

        • 1. Re: Need multiple drop down menus to populate text in one text box
          MarkWalsh Level 4

          I would create a single function to set the Notes field. In that function, concatenate all of the results for each dropdown into a string, and set the notes field to the string. Call that function in the onBlur event for each dropdown.

          • 2. Re: Need multiple drop down menus to populate text in one text box
            govtech77 Level 1

            I am not familiar with writting string. Can you give me a short example? Say if my drop down boxes were named

            1. 'SE' and 2. 'SQ' with my text box named 'NOTES'

            • 3. Re: Need multiple drop down menus to populate text in one text box
              MarkWalsh Level 4

              This is quick and from memory, i can't test it right now, but it should give you an idea. Put this in a document level script:

               

              function SetNotesField() {

                   // Set up a variable to hold the entire NOTES field value

                   var Notes

                  

                   // Add the value for each dropdown box here (replace 'GetValueFor_SE_FieldHere' with the value you will use for that dropdown)

                   if (this.getField('SE').value == 'true') {

                        Notes = Notes + 'GetValueFor_SE_FieldHere' + '\r'  // add a carriage return if needed

                   }

                   if (this.getField('SQ').value == 'true') {

                        Notes = Notes + 'GetValueFor_SQ_FieldHere' + '\r'  // add a carriage return if needed

                   }

                  //...Duplicate the above for any other fields you need

                  

                   // Set the value of the notes field to the concatenated value for all dropdowns.

                   this.getField('NOTES').value = Notes

              }

               


              For each dropdown field, add the following to the 'OnBlur' event:

               

              SetNotesField()