6 Replies Latest reply on Nov 21, 2010 2:01 PM by Jo_2005

    Values from an Application Response Dialog to Multiline Text Box Field

    Jo_2005 Level 1

      Hello,

       

      When a radio button is clicked on my form an application response dialog is shown for the user to enter data.

       

      The value from the response dialog is then added to a multiline text box.

       

      The script is on the mouse up action of the radio button and works fine the first time the radio button is clicked.

       

      If the radio button is clicked again, the value from the response dialog overrides the existing value in the multiline text box.

       

      What I need to do is have the response values show on a new line in the text box each time the radio button is clicked.

       

      Can any one please advise how to revise my script for this to work?

       

      //Target Field multiline text box

      var t = this.getField("ActionAgenda");

       

      // Response Dialog when radio button is clicked

      var cResponse = app.response({

      cQuestion: "Enter your Action Agenda Item",

      cTitle: "Action Agenda"});

       

      // Alert dialog if cancelled

       

      if (cResponse == null){

      app.alert ("Action Agenda Item will not be entered");

       

      // Place the data from the dialog to the target field

      }else{

      t.value  = cResponse;

      }

       

       

      Any assistance will be greatly appreciated.

       

      Thank you

       

       

       

       

        • 1. Re: Values from an Application Response Dialog to Multiline Text Box Field
          try67 MVP & Adobe Community Professional

          Change this line:
          t.value  = cResponse;


          To this:
          t.value += "\n" + cResponse;

          • 2. Re: Values from an Application Response Dialog to Multiline Text Box Field
            Jo_2005 Level 1

            Thank you so much for your reply.

             

            Your solution works perfectly.

             

            Is it possible to expand/ add height to the multiline text box with javascript each time a new response is added?

             

            I would like to see all items in the text box rather than up/down arrows which appears after you add more than one item.

             

            Thanks again.

             

            Jo

             

            • 3. Re: Values from an Application Response Dialog to Multiline Text Box Field
              try67 MVP & Adobe Community Professional

              Then you should set the text size to Auto. Trying to resize the text-box is

              not very practical.

              1 person found this helpful
              • 4. Re: Values from an Application Response Dialog to Multiline Text Box Field
                Jo_2005 Level 1

                Thank you for your advice.

                 

                I changed the text size to auto, except it made the text size smaller each time a response was added.

                 

                I have been able to incorporate an expanding text box into the script.

                 

                My next question, is  there a way to have the text box expand and collapse on the click of a button?

                 

                //Target Field

                var t = this.getField("ActionAgenda");

                 

                // Response Dialog

                var cResponse = app.response({

                cQuestion: "Enter your Action Agenda Item",

                cTitle: "Action Agenda"});

                 

                // Alert dialog if cancelled

                 

                if (cResponse == null){

                app.alert ("Action Agenda Item will not be entered");

                 

                // Place the data from the dialog to the target field

                }else{

                t.value  += cResponse + "\n";

                }

                var f = this.getField("ActionAgenda");

                var aRect = f.rect;// Get bounding rectangle

                f.multiline = true;// Make it multiline

                var height = aRect[1]-aRect[3];// Calculate height

                aRect[3] -= 0.2* height;// Change the height of the text field

                f.rect = aRect;// and make it so

                 

                 

                Thank you for your advice.

                 

                 

                • 5. Re: Values from an Application Response Dialog to Multiline Text Box Field
                  MarkWalsh Level 4

                  You might want to look into creating the form in LiveCycle. There are tools available to do more advanced things than in standard Acrobat. I'm not sure if you can create a field which automatically expands to fit the text (I think you can, but I'm not 100% certain), but you can create dynamic forms which you can add lines to (i.e. you can add as many line items to an invoice as you need) so instead of using a single text field, you can add a new line for each agenda item.

                  • 6. Re: Values from an Application Response Dialog to Multiline Text Box Field
                    Jo_2005 Level 1

                    Thanks for your reply Mark.

                     

                    I initially designed the form in liveycle, and used the add instance row successfully to add an item.  The sticking point came however, when a systems clock and stop watch was required in the form as well.

                     

                    After extensive trials the systems clock and stop watch could not be used effectively in livecycle, hence the form was then redesigned in the front end of Adobe (Acro Form).

                     

                    There were no issues in creating a systems clock and stop watch, but now I have the opposite problem with expanding text boxes.  Catch 22 here!

                     

                    I would greatly appreciate if you can offer any help with the expanding text box in the acro form.

                     

                    Many thanks for your time!

                     

                    Jo