2 Replies Latest reply on May 31, 2015 6:10 AM by tbrookes1980

    Script to produce an outcome based on user selections in three groups of radio buttons

    tbrookes1980 Level 1

      I have three sets of radio buttons in my adobe form. One set is "Likelihood" second set is "Consequence", third set is "Injuries" What I want to do is have users pick the likelihood, the consequence and whether or not injuries occurred and have the form populate the risk rating. For example, if they pick: Insignificant, Rare and No injuries, it should display in another field "Low Risk Hazard"

      I have written the below code, but I keep getting this error: SyntaxError: illegal character 30: at line 31.

       

      I am new to coding and have no idea what's wrong. Can you help?

       

      var consequence = this.getField("Consequence").valueAsString; 
      var likelihood = this.getField("Likelihood").valueAsString; 
      var injuries = this.getField("Injuries").valueAsString;
        
           if (consequence=="Insignificant" && likelihood=="Rare" && injuries=="No injuries") event.value = "Low Risk Hazard"; 
      else if (consequence=="Insignificant" && likelihood=="Unlikely" && injuries=="No injuries") event.value = "Low Risk Hazard";
      else if (consequence=="Insignificant" && likelihood=="Moderate" && injuries=="No injuries") event.value = "Low Risk Hazard";
      else if (consequence=="Insignificant" && likelihood=="Likely" && injuries=="No injuries") event.value = "Low Risk Hazard";
      else if (consequence=="Insignificant" && likelihood=="Almost Certain" && injuries=="No injuries") event.value = "Moderate Risk Hazard"; 
      else if (consequence=="Minor" && likelihood=="Rare" && injuries=="No injuries") event.value = "Low Risk Hazard"; 
      else if (consequence=="Minor" && likelihood=="Unlikely" && injuries=="No injuries") event.value = "Low Risk Hazard";
      else if (consequence=="Minor" && likelihood=="Moderate" && injuries=="No injuries") event.value = "Moderate Risk Hazard";
      else if (consequence=="Minor" && likelihood=="Likely" && injuries=="No injuries") event.value = "Moderate Risk Hazard";
      else if (consequence=="Minor" && likelihood=="Almost Certain" && injuries=="No injuries") event.value = "High Risk Hazard"; 
      else if (consequence=="Moderate" && likelihood=="Rare" && injuries=="No injuries") event.value = "Low Risk Hazard"; 
      else if (consequence=="Moderate" && likelihood=="Unlikely" && injuries=="No injuries") event.value = "Moderate Risk Hazard";
      else if (consequence=="Moderate" && likelihood=="Moderate" && injuries=="No injuries") event.value = "High Risk Hazard";
      else if (consequence=="Moderate" && likelihood=="Likely" && injuries=="No injuries") event.value = "High Risk Hazard";
      else if (consequence=="Moderate" && likelihood=="Almost Certain" && injuries=="No injuries") event.value = "Critical Risk Hazard"; 
      else if (consequence=="Major" && likelihood=="Rare" && injuries=="No injuries") event.value = "Low Risk Hazard"; 
      else if (consequence=="Major" && likelihood=="Unlikely" && injuries=="No injuries") event.value = "Moderate Risk Hazard";
      else if (consequence=="Major" && likelihood=="Moderate" && injuries=="No injuries") event.value = "High Risk Hazard";
      else if (consequence=="Major" && likelihood=="Likely" && injuries=="No injuries") event.value = "Critical Risk Hazard";
      else if (consequence=="Major" && likelihood=="Almost Certain" && injuries=="No injuries") event.value = "Extreme Risk Hazard"; 
      else if (consequence=="Catastrophic" && likelihood=="Rare" && injuries=="No injuries") event.value = "Moderate Risk Hazard"; 
      else if (consequence=="Catastrophic" && likelihood=="Unlikely" && injuries=="No injuries") event.value = "High Risk Hazard";
      else if (consequence=="Catastrophic" && likelihood=="Moderate" && injuries=="No injuries") event.value = "Critical Risk Hazard";
      else if (consequence=="Catastrophic" && likelihood=="Likely" && injuries=="No injuries") event.value = "Extreme Risk Hazard";
      else if (consequence=="Catastrophic" && likelihood=="Almost Certain" && injuries=="No injuries") event.value = "Extreme Risk Hazard";
      else if (consequence=="Insignificant" && likelihood=="Rare" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”; 
      else if (consequence=="Insignificant" && likelihood=="Unlikely" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”;
      else if (consequence=="Insignificant" && likelihood=="Moderate" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”;
      else if (consequence=="Insignificant" && likelihood=="Likely" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”;
      else if (consequence=="Insignificant" && likelihood=="Almost Certain" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”; 
      else if (consequence=="Minor" && likelihood=="Rare" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”; 
      else if (consequence=="Minor" && likelihood=="Unlikely" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”;
      else if (consequence=="Minor" && likelihood=="Moderate" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”;
      else if (consequence=="Minor" && likelihood=="Likely" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”;
      else if (consequence=="Minor" && likelihood=="Almost Certain" && injuries==“Yes injuries”) event.value = "High Risk Hazard with injury”; 
      else if (consequence=="Moderate" && likelihood=="Rare" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”; 
      else if (consequence=="Moderate" && likelihood=="Unlikely" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”;
      else if (consequence=="Moderate" && likelihood=="Moderate" && injuries==“Yes injuries”) event.value = "High Risk Hazard with injury”;
      else if (consequence=="Moderate" && likelihood=="Likely" && injuries==“Yes injuries”) event.value = "High Risk Hazard with injury”;
      else if (consequence=="Moderate" && likelihood=="Almost Certain" && injuries==“Yes injuries”) event.value = "Critical Risk Hazard with injury”; 
      else if (consequence=="Major" && likelihood=="Rare" && injuries==“Yes injuries”) event.value = "Low Risk Hazard with injury”; 
      else if (consequence=="Major" && likelihood=="Unlikely" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”;
      else if (consequence=="Major" && likelihood=="Moderate" && injuries==“Yes injuries”) event.value = "High Risk Hazard with injury”;
      else if (consequence=="Major" && likelihood=="Likely" && injuries==“Yes injuries”) event.value = "Critical Risk Hazard with injury”;
      else if (consequence=="Major" && likelihood=="Almost Certain" && injuries==“Yes injuries”) event.value = "Extreme Risk Hazard with injury”; 
      else if (consequence=="Catastrophic" && likelihood=="Rare" && injuries==“Yes injuries”) event.value = "Moderate Risk Hazard with injury”; 
      else if (consequence=="Catastrophic" && likelihood=="Unlikely" && injuries==“Yes injuries”) event.value = "High Risk Hazard with injury”;
      else if (consequence=="Catastrophic" && likelihood=="Moderate" && injuries==“Yes injuries”) event.value = "Critical Risk Hazard with injury”;
      else if (consequence=="Catastrophic" && likelihood=="Likely" && injuries==“Yes injuries”) event.value = "Extreme Risk Hazard with injury”;
      else if (consequence=="Catastrophic" && likelihood=="Almost Certain" && injuries==“Yes injuries”) event.value = "Extreme Risk Hazard with injury”;

      // etc. 
      else event.value = ""; 
      if (event.value=="Low Risk Hazard") event.target.fillColor = color.green; 
      else if (event.value=="Low Risk Hazard with injury") event.target.fillColor = color.green; 
      else if (event.value=="High Risk Hazard") event.target.fillColor = ["RGB", 1, 0.5, 0]; // = Orange  
      else if (event.value=="High Risk Hazard with injury") event.target.fillColor = ["RGB", 1, 0.5, 0]; // = Orange  
      else if (event.value=="Critical Risk Hazard") event.target.fillColor = color.red;  
      else if (event.value=="Critical Risk Hazard with injury") event.target.fillColor = color.red;  
      else if (event.value=="Moderate Risk Hazard") event.target.fillColor = color.yellow;
      else if (event.value=="Moderate Risk Hazard with injury") event.target.fillColor = color.yellow;
      else if (event.value=="Extreme Risk Hazard") event.target.fillColor = color.gray;
      else if (event.value=="Extreme Risk Hazard with injury") event.target.fillColor = color.gray;

      // etc.  
      else event.target.fillColor = color.white;