2 Replies Latest reply on Feb 16, 2012 6:18 AM by Soren Hoy

    Livecycle populate text field with multiple records from list box

    Legro22

      Can someone tell me how can I populate a text field from list box when I have multiple select.

      Here is example:

      List box consist: Hello

                               World.

       

      I want to see this in text field: Hello,World.

       

      Thanks!

        • 1. Re: Livecycle populate text field with multiple records from list box
          paulk07 Level 3

          if(xfa.event.prevText=="")

          {

          textfield.rawValue = xfa.event.newText;

          }

          if(xfa.event.prevText!="")

          {

          textfield.rawValue = texfield.rawValue+"\n"+xfa.event.newText;

          }

           

          I think something like this may work.

          • 2. Re: Livecycle populate text field with multiple records from list box
            Soren Hoy Level 1

            Hi Legro

            I don't know if I understand you correctly, but you can do something like this:

            ----------------- java script begin ---------------------------------

            //Reset text field

            TextField.rawValue = "";

             

             

            //loop through items in listbox

            for(i = 0; i < ListBox.length; i++)

            {

                      //if item selected

                      if(ListBox.getItemState(i))

                      {

                                //check if Text field value if null

                                if (TextField.isNull)

                                {

                                          TextField.rawValue = ListBox.getDisplayItem(i);

                                }

                                else

                                {

                                          TextField.rawValue = TextField.rawValue + " " + ListBox.getDisplayItem(i);

                                }

             

                      }

            }

            ----------------- java script end ---------------------------------

             

            I have attached an sample PDF so that you can see how it works!!

             

            Kind Regards

            Søren Høy Nielsen Dafolo A/S