These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Copy fields

mreiman56
Registered: Nov 9 2009
Posts: 8
Answered

I am trying to copy a set of fields to another identical set using a checkbox in LiveCycle Designer. I have pasted my script below. Can anyone help me as I am not sure what I am missing.

Javascript beginner

Thanks

// check the state of the button
if(this.getField('copyfields').value == '1') {
// checked
// copy requestor information
// get each requestor field object's value and set the sponsor field's value
this.getField('rname').value = this.getField('sname').value;
this.getField('rphone').value = this.getField('sphone').value;
this.getField('rdept').value = this.getField('sdept').value;
this.getField('remail').value = this.getField('semail').value;
this.getField('rtitle').value = this.getField('stitle').value;
// lock fields
// set each sponsor field's read only property to locked - true
this.getField('sname').readonly = true;
this.getField('sphone').readonly = true;
this.getField('sdept').readonly = true;
this.getField('semail').readonly = true;
this.getField('stitle').readonly = true;
} else {
// unchecked
// unlock fields
// set each sponsor field's readonly property to unlocked - false
this.getField('sname').readonly = false;
this.getField('sphone').readonly = false;
this.getField('sdept').readonly = false;
this.getField('semail').readonly = false;
this.getField('stitle').readonly = false;
}

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

the JavaScript you used is for AcroForms and not supported by LiveCycle Designer.
To get it work in Designer you need to change the script.

form1.#subform[0].CheckBox1::change - (JavaScript, client) // If the checkbox is checked...if (this.rawValue == 1){// ...then put the value of TextField54 into TextField5...xfa.resolveNode("form1.#subform.TextField5").rawValue = xfa.resolveNode("form1.#subform.TextField4").rawValue;// ...and make it read only.xfa.resolveNode("form1.#subform.TextField5").access = "readOnly";}// If the checkbox is unchecked...else{// ...clear TextField5 and make it accessible.xfa.resolveNode("form1.#subform.TextField5").rawValue = null;xfa.resolveNode("form1.#subform.TextField5").access = "open";}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs