2 Replies Latest reply on Dec 7, 2012 5:52 PM by freelance_java_n00b

    If/Else Statement with Drop-Down List

    freelance_java_n00b Level 1

      Hi!

       

      So I am trying to get the value for a hidden field in a form (which will be the basis for some other calculations in the form) based on what is selected from a drop down list. If "signed" is selected from the list, then the value = the value inputted in the "TimeAddedToDate" field. If "unsigned" is selected, then the value = 0.

       

      This way I can correctly make some other calculations on the form.

       

      I am having a problem with writing the javascript, though. I was hoping I would be able to figure it out from reading some javascript forums, but no luck so far.

       

      Any help would be greatly appreciated!!!

       

      This is my failed attempt:

       

      var Time = this.getField("TimeAddedToDate").value;

      var Select = this.getField("ToDateOrderStatus").value;

      if(Select == "Unsigned")event.value = 0;

      else if (Select == "Signed")event.value = Time;