3 Replies Latest reply on Jun 11, 2013 2:07 PM by try67

    JS Action for checkbox producing opposite effect

    Philo Bedoe

      Hello,

       

      I have a form with a "shipping address same as billing address" checkbox. I want the shipping address fields to populate when the checkbox is checked. My script (below) is producing the opposite effect, filling the fields when the box is unchecked and clearing the fields when it is checked. The script is triggered by mouseup on the checkbox.

       

      Can someone tell me what is wrong? I have little JS knowledge.

       

      Thanks in advance!

       

       

      if (event.target.value!="ON")

      {

      this.getField("PrimContact Name").value = this.getField("Owner Name").value; 

      this.getField("PrimContact Phone").value = this.getField("Owner Phone").value; 

      this.getField("PrimContact Email").value = this.getField("Owner Email").value;

      this.getField("PrimContact Title").value = "Property Owner";

      }

      else

      {

      this.getField("PrimContact Name").value = '';

      this.getField("PrimContact Phone").value = '';

      this.getField("PrimContact Email").value = '';

      this.getField("PrimContact Title").value = '';

      }