2 Replies Latest reply on Oct 17, 2015 2:36 AM by tbrookes1980

    What's wrong with my javascript?

    tbrookes1980 Level 1

      I have been working on the below script but can't find the problem:

       

      var Contact? = this.getField("Contact?").valueAsString; 

      var Open Wound? = this.getField("Open Wound?").valueAsString; 

      var Carried disease? = this.getField("Carried disease?").valueAsString;

      var disease = this.getField("Disease").valueAsString;

       

                       

           if (Contact?=="Yes" && Open Wound?=="Yes" && Carried disease?=="Yes" && Disease=="HIV") event.value = "You should get a blood test"; 

      else if (Contact?=="Yes" && Open Wound?=="Yes" && Carried disease?=="Yes" && Disease=="Hepatitis") event.value = "You should see your Doctor";

      // etc. 

      else event.value = ""; 

      if (event.value=="You should get a blood test") event.target.fillColor = color.green; 

      else if (event.value=="You should see your Doctor") event.target.fillColor = color.green; 

      // etc.  

      else event.target.fillColor = color.white;    

       

      I get an error "SyntaxError: missing ; before statement 1: at line 2" but I can't work out what's wrong.

       

      Essentially, I want to ask four questions and then depending on the answers, populate a recommendation.

       

      Any help would be appreciated.

      Thanks!