1 Reply Latest reply on Oct 15, 2013 4:12 PM by The King of Milk2

    Auto-populate based on check box


      I am fairly new to the whole scripting idea in both Javascript and Formcalc for forms. I have created a form that needs some dear attention. What I am trying to do is autopopulate text fields based off the checkbox, if it's turned on or not.



      Example:  Once the property information - property name, street address, city, state and zipcode (at the top of form) is filled in. If the check box is checked in the Payer information section (at the bottom) it will enter the information from the property information in the address fields below in the assigned text fields.


      Here is my Javascript code (not complete):



      FLContract.#subform[0].PayerName::calculate - (JavaScript, client)


      var a =""

      if (this.getField(CheckBoxPropertyInfo).value == 1)



        • 1. Re: Auto-populate based on check box
          The King of Milk2

          Enter this under the "Change" option of the script editor for the checkbox. just rename your fields appropriately. The second "If" will reset the fields if they accidently clicked it. Name[1] is the field you want the checkbox to fill. 'Name' is the original field.


          if (this.rawValue == "1") {

            this.resolveNode("Name[1]").rawValue = this.resolveNode("Name").rawValue;

            this.resolveNode("Address[1]").rawValue = this.resolveNode("Address").rawValue;

            this.resolveNode("City[1]").rawValue = this.resolveNode("City").rawValue;

            this.resolveNode("State[1]").rawValue = this.resolveNode("State").rawValue;

            this.resolveNode("ZipCode[1]").rawValue = this.resolveNode("ZipCode").rawValue;

            this.resolveNode("Country[1]").rawValue = this.resolveNode("Country").rawValue;


          if (this.rawValue == "0") {

            this.resolveNode("Name[1]").rawValue = "";

            this.resolveNode("Address[1]").rawValue = "";

            this.resolveNode("City[1]").rawValue = "";

            this.resolveNode("State[1]").rawValue = "";

            this.resolveNode("ZipCode[1]").rawValue = "";

            this.resolveNode("Country[1]").rawValue = "";