Help for fix script to populate ship to fields when I click same as above
- March 16, 2021
- 1 reply
- 2923 views
Hi, in the attach pdf form. I've 3 fields in customer details section:
1. name
2. address
3. address2
I want to auto populate data from this 3 fields to "Ship to" section (bellow fields) if I click "SameAsAbove" checkbox:
1. Nameofshipping
2. Addressofshipping
2. Address2ofshipping
I've added bellow script in the chckbox field<Action<Mouse Up<Ran a Javascript:
// check the state of the buttonif(this.getField(event.target.name).value == 'Yes') {// checked// copy address information// get each billing field object's value and set the shipping field's valuethis.getField('name').value = this.getField('nameofshipping').value;this.getField('address').value = this.getField('Addressofshipping').value;this.getField('Address2').value = this.getField('Address2ofshipping').value; // lock fields// set each shipping field's read only property to locked - truethis.getField('name').readonly = true;this.getField('address').readonly = true;this.getField('Address2').readonly = true;} else {// unchecked// unlock fields// set each shipping field's readonly property to unlocked - falsethis.getField('name').readonly = false;this.getField('address').readonly = false;this.getField('Address2').readonly = false;}
But the fucntion is not working. anyone could help me in this regard. BTW I've no idea about writing java script. However thanks in advance
