3 Replies Latest reply on Dec 26, 2016 5:41 AM by stevenm8611492

    KeyScript help

    stevenm8611492

      This code is not working like I think is should, some times it over writes the values in the dropdown field and other times it drop the values down 2 spaces

      each "ASAValue1 -> ASAValue16" is a Dropdown Field, with a possible Dropdown Field name of CSk1 -> CSk23

       

      I don't see these  app.alert come up either:

       

      app.alert("We are in the CareerSkills Function ASAValue : " + ASAValue, 3);

      app.alert("We are in the CareerSkills Function CSkASAValue1 : " + CSkASAValue1, 3);

       

      TotalSkillsAdjustment Field is from 0 -> 7

       

      var ASAValue = this.getField("TotalSkillsAdjustment").value;
      app.alert("We are in the KeyStroke CareerSkills ASAValue : " + ASAValue, 3);
      var ASAValue1 = "CSk" + (ASAValue + 1);
      var ASAValue2 = "CSk" + (ASAValue + 2);
      var ASAValue3 = "CSk" + (ASAValue + 3);
      var ASAValue4 = "CSk" + (ASAValue + 4);
      var ASAValue5 = "CSk" + (ASAValue + 5);
      var ASAValue6 = "CSk" + (ASAValue + 6);
      var ASAValue7 = "CSk" + (ASAValue + 7);
      var ASAValue8 = "CSk" + (ASAValue + 8);
      var ASAValue9 = "CSk" + (ASAValue + 9);
      var ASAValue10 = "CSk" + (ASAValue + 10);
      var ASAValue11 = "CSk" + (ASAValue + 11);
      var ASAValue12 = "CSk" + (ASAValue + 12);
      var ASAValue13 = "CSk" + (ASAValue + 13);
      var ASAValue14 = "CSk" + (ASAValue + 14);
      var ASAValue15 = "CSk" + (ASAValue + 15);
      var ASAValue16 = "CSk" + (ASAValue + 16);
      app.alert("We are in the KeyStroke CareerSkills ASAValue1 : " + ASAValue1, 3);
      app.alert("We are in the KeyStroke CareerSkills ASAValue2 : " + ASAValue2, 3);
      app.alert("We are in the KeyStroke CareerSkills ASAValue16 : " + ASAValue16, 3);

      if (event.willCommit)
      {
        if (event.value == "")
        {
         app.alert("We are in the KeyStroke CareerSkills Willcommit == ", 3);
         this.resetForm (["ASAValue1", "ASAValue2", "ASAValue3", "ASAValue4", "ASAValue5", "ASAValue6", "ASAValue7", "ASAValue8", "ASAValue9", "ASAValue10", "ASAValue11", "ASAValue12", "ASAValue13", "ASAValue14", "ASAValue15", "ASAValue16"]);
        }
        else
        {
         app.alert("We are in the KeyStroke CareerSkills else ", 3);
         SetCareerSkillsFieldValues(event.value); //No Error
         //SetCareerSkillsFieldValues(event.change); - I tried this in trouble shooting - Error
        }
      }

      var ASAValue = this.getField("TotalSkillsAdjustment").value;
      app.alert("We are in the CareerSkills Function ASAValue : " + ASAValue, 3);

      var CSkASAValue1 = "CSk" + (ASAValue + 1);
      var CSkASAValue2 = "CSk" + (ASAValue + 2);
      var CSkASAValue3 = "CSk" + (ASAValue + 3);
      var CSkASAValue4 = "CSk" + (ASAValue + 4);
      var CSkASAValue5 = "CSk" + (ASAValue + 5);
      var CSkASAValue6 = "CSk" + (ASAValue + 6);
      var CSkASAValue7 = "CSk" + (ASAValue + 7);
      var CSkASAValue8 = "CSk" + (ASAValue + 8);
      var CSkASAValue9 = "CSk" + (ASAValue + 9);
      var CSkASAValue10 = "CSk" + (ASAValue + 10);
      var CSkASAValue11 = "CSk" + (ASAValue + 11);
      var CSkASAValue12 = "CSk" + (ASAValue + 12);
      var CSkASAValue13 = "CSk" + (ASAValue + 13);
      var CSkASAValue14 = "CSk" + (ASAValue + 14);
      var CSkASAValue15 = "CSk" + (ASAValue + 15);
      var CSkASAValue16 = "CSk" + (ASAValue + 16);
      app.alert("We are in the CareerSkills Function CSkASAValue1 : " + CSkASAValue1, 3);

       

      var SkASAValue1 = "Sk" + (ASAValue + 1);
      var SkASAValue2 = "Sk" + (ASAValue + 2);
      var SkASAValue3 = "Sk" + (ASAValue + 3);
      var SkASAValue4 = "Sk" + (ASAValue + 4);
      var SkASAValue5 = "Sk" + (ASAValue + 5);
      var SkASAValue6 = "Sk" + (ASAValue + 6);
      var SkASAValue7 = "Sk" + (ASAValue + 7);
      var SkASAValue8 = "Sk" + (ASAValue + 8);
      var SkASAValue9 = "Sk" + (ASAValue + 9);
      var SkASAValue10 = "Sk" + (ASAValue + 10);
      var SkASAValue11 = "Sk" + (ASAValue + 11);
      var SkASAValue12 = "Sk" + (ASAValue + 12);
      var SkASAValue13 = "Sk" + (ASAValue + 13);
      var SkASAValue14 = "Sk" + (ASAValue + 14);
      var SkASAValue15 = "Sk" + (ASAValue + 15);
      var SkASAValue16 = "Sk" + (ASAValue + 16);
      app.alert("We are in the CareerSkills Function SkASAValue1 : " + SkASAValue1, 3);

      var CareerSkills = {

      //too many to paste

      };

       

      function  SetCareerSkillsFieldValues(cCareerSkills) {

      this.getField(CSkASAValue1).value = CareerSkills[cCareerSkills].SkASAValue1;

      this.getField(CSkASAValue2).value = CareerSkills[cCareerSkills].SkASAValue2;

      this.getField(CSkASAValue3).value = CareerSkills[cCareerSkills].SkASAValue3;

      this.getField(CSkASAValue4).value = CareerSkills[cCareerSkills].SkASAValue4;

      this.getField(CSkASAValue5).value = CareerSkills[cCareerSkills].SkASAValue5;

      this.getField(CSkASAValue6).value = CareerSkills[cCareerSkills].SkASAValue6;

      this.getField(CSkASAValue7).value = CareerSkills[cCareerSkills].SkASAValue7;

      this.getField(CSkASAValue8).value = CareerSkills[cCareerSkills].SkASAValue8;

      this.getField(CSkASAValue9).value = CareerSkills[cCareerSkills].SkASAValue9;

      this.getField(CSkASAValue10).value = CareerSkills[cCareerSkills].SkASAValue10;

      this.getField(CSkASAValue11).value = CareerSkills[cCareerSkills].SkASAValue11;

      this.getField(CSkASAValue12).value = CareerSkills[cCareerSkills].SkASAValue12;

      this.getField(CSkASAValue13).value = CareerSkills[cCareerSkills].SkASAValue13;

      this.getField(CSkASAValue14).value = CareerSkills[cCareerSkills].SkASAValue14;

      this.getField(CSkASAValue15).value = CareerSkills[cCareerSkills].SkASAValue15;

      this.getField(CSkASAValue16).value = CareerSkills[cCareerSkills].SkASAValue16;

      }

        • 1. Re: KeyScript help
          gkaiseril MVP & Adobe Community Professional

          JavaScript is an interpreted language like Basic. It processes one line at a time and stops processing whenever it encounters an error in syntax or executing a line cod. It will display an error message in the JavaScript console.

           

          Open the JavaScript console and see if there are any messages. If the console does not open on an error, use the key combination of <Ctrl/Option> + "J" to open the console or use the Create Form or JavaScript tool to open the console. The error message will provide the line number or a close line number to the error and a very brief message about the error.

           

          With such a large script you might want to post a link to a sample form exhibiting your problem.

          • 2. Re: KeyScript help
            stevenm8611492 Level 1

            There are no Error in the Console, that would help, but no errors

            • 3. Re: KeyScript help
              stevenm8611492 Level 1

              I fixed it, moved the code before the array into the function