6 Replies Latest reply on Aug 15, 2012 6:28 AM by Cat13blue

    Java script help for popup dialog boxes

    Cat13blue

      Hi, I have been trying to create a popup dialog box to tell users to fill in certain form fields. I don't know Java so I have been using a script that I found in the forums, but I need to be able to modify the text. Can anyone tell me how to do this? Here is the script. Thanks.

       

      var requiredFields = [], error = "";

      for (var i = 0; i < numFields; i++) {

          var fName = getNthFieldName(i);

          var f = getField(fName);

          if (f.type !== "button" && f.required && !f.valueAsString) {

              requiredFields.push(fName);

              error += fName + "\r";

          }

      }

      if (error) {

          app.alert("Please complete the following fields: \r\r" + error, 3);

          getField(requiredFields[0]);

      } else {

      }

        • 1. Re: Java script help for popup dialog boxes
          George_Johnson MVP & Adobe Community Professional

          What text do you want to modify, exactly?

          • 2. Re: Java script help for popup dialog boxes
            Cat13blue Level 1

            Hi George, currently this script creates a popup dialog box with the following text: Home telephone number, mailing address, name, position applying for, residence address, social security number and work telephone number. These are the first set of text fields in my form. I would like to have two more popup boxes for other sections that would have the following text: popup 1: Convicted of a violation other than a minor traffic violation and Removed from any type of employment. Popup 2: U.S. Citizen, N.Y. Driver's License, Part-time work, Legal right to work in U.S., and Temporary work. I tried to figure out how the script above created the list of home telephone number, mailing address, name, position applying for, residence address, social security number and work telephone number for the popup dialog box but I'm afraid that it was beyond me. Any help would be greatly appreciated. Thanks

            • 3. Re: Java script help for popup dialog boxes
              George_Johnson MVP & Adobe Community Professional

              The script currently gets that text from the field names. What you want would make for rather long field names, but the script could be changed to use the field's tooltip text instead, or you could do something like set up an array to associate field descriptions with field names. So what will work with the current script is to simply change the field names to suit your needs, but I would personally use one of the other approaches. Post again if you need more help.

              • 4. Re: Java script help for popup dialog boxes
                Cat13blue Level 1

                Hi George thank you so much for the information. Can I ask you one more question? Is there a way that this script can be made to work with radio buttons? Thanks

                • 5. Re: Java script help for popup dialog boxes
                  George_Johnson MVP & Adobe Community Professional

                  The current script is really just for text fields, so it would have to be modified to work with check boxes, radio buttons, list boxes and dropdowns. With radio buttons, either none can be selected by default or one could be, indicating that a valid option has not been selected. I would have to know how you have the radio button group set up to suggest some code you could use.

                  • 6. Re: Java script help for popup dialog boxes
                    Cat13blue Level 1

                    Hi George each set of radio buttons has been given the same name and only one of them can be chosen by the user and they are set so that the button is not checked by default. Thanks