4 Replies Latest reply on Jun 11, 2012 1:00 AM by Geertruida Maria

    Summary in a form - how to show reference?

    Geertruida Maria

      Hi, I am making a form, on the last page, I want to show a summary of what has been filled out.

      There are 7 pages which of 5 have each a radiobutton group and a textbox.

      On the summary I want to show which radiobutton has been chosen and which comment has been written.

       

      I am very unsure how to do this.

      Should I set an action to the radiobutton group itself, with a trigger 'on exit' and give it a 'Run a javascript' action? or should the Js be connected to the summary page, in a new textbox that shows the output of the radiobuttongroup?

       

      I really would like some help on a javascript that will simply show the contents of a textbox.

      I tried with my limited skills, but it doesn't work:

       

      var a= this.getField ("HSEComment");

      var b= this.getField ("HSESummary");

      b.value = a.value

       

      Anyone?

      thanks in advance!

      Trudie

        • 1. Re: Summary in a form - how to show reference?
          George_Johnson MVP & Adobe Community Professional

          I would probably implement it as a custom calculate script for the summary field. In your example of a single field to summarize, the code could look something like:

           

          // Get the field values

          var a = getField("HSEComment");

           

          // Set this field value

          event.value = a;

           

           

          You can use a single multiline text field to summarize multiple fields. To add another field and separate with a blank line, do something like:

           

          // Get the field values

          var v1 = "Description 1 goes here: " + getField("HSEComment").valueAsString;

          var v2 = "Description 2 goes here: " + getField("another_field").valueAsString;

           

          // Set this field value, adding a blank line between values

          event.value = v1 + "\r\r" + v2;

           

          This doesn't demonstrate how to better deal with check box or radio button groups, but it should get you started. Post again if you get stuck.

          • 2. Re: Summary in a form - how to show reference?
            Geertruida Maria Level 1

            Hi George, thanks for your help - It worked fine with the second half; the textboxes - (comments).

            But it didn't work with the radiobuttons output.

             

            The radiobutton group name is f.ex. HSE_rating

            I want the chosen button's output (a choice of 6 - with numbering from 1 to 6) to be shown on the summary page in a textbox.

             

            the script:

            // Get the field values

            var a = getField("HSEComment");

             

            // Set this field value

            event.value = a;

             

            did not do the trick... do you have any other suggestions?

            I tried with a simple; "Value is the sum(+) of the following fields" and chose the HSE_rating,

            but this does not seem to work always. Sometimes it gives the right output, and sometimes something totaly different.

             

            Could you please take another look?

            Thanks!

             

            regards, Trudie

            • 3. Re: Summary in a form - how to show reference?
              George_Johnson MVP & Adobe Community Professional

              Sorry, I left off an important part. The script should be:

               

              // Get the field values

              var a = getField("HSEComment").valueAsString;

               

              // Set this field value

              event.value = a;

              • 4. Re: Summary in a form - how to show reference?
                Geertruida Maria Level 1

                Hi George, sorry for my somewhat late response,

                thank you very much for the help - really appreciated!

                 

                I changed the code and added the .valueAsString

                when the form is fresh (not filled out before), it works fine - all the values are correct.

                But when changing the values of the original radiobutton groups- something goes wrong:

                 

                I've got 5 series of radiobutton groups - when the form has been filled out once and you go back to change to/choose another value of the radiobuttons, the output on the summary gets wrong.

                My guess is that there has to be a 'refresh' or 'update' trigger - still it's strange that only the first output box gives a wrong value - the other ones seems to be ok.

                 

                any idea how to fix this?

                regards, Trudie