1 Reply Latest reply on Jul 16, 2015 10:57 AM by JohnnyBQue

    Probelms with a If/else statement...

    JohnnyBQue

      the section in bold below I can't get it to return a value of "1". it purpose is to generate a 1 when none of the 5 radio buttons "answers" has been selected for Q1...Am I using the "||" correctly?

       

       

      var Answer = this.getField("Q1").value;  

      var Grade1;

      var Missing1; 

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

      var g = this.getField(f.name+".1");

       

      if (Answer == "Choiced")

      {var Grade1 = 1}

      else

      {var Grade1 = 0}

       

      if (Answer == "Choiced")

      {g.strokeColor = color.black}

      else

      {g.strokeColor = color.green}

       

      if (Answer == "Choicea"||"Choiceb"||"Choicec"||"Choiced"||"Choicee")    //these are the 5 radio button values for the radio group Q1 if one has been selected

      {var Missing1 = 0}                                                                                    //then "Missing1" should = 0

      else

      {var Missing1 = 1}                                                                                    //if none of the 5 answers were selected "Missing1" should = 1  ...at least that's how I want it to work...      

       

       

      this.getField("SumCorrect").value = Grade1;

      this.getField("Missing").value = Missing1;

       

      //if (Missing < "1")

      //if (this.getField("Missing").value < "1")

      //app.alert("All questions have been answered", 4)

      //else

      //app.alert("Not all questions have been answered")