Skip to main content
yanksgirl
Inspiring
April 14, 2026
Answered

Make multiple linked fields editable without changing the others

  • April 14, 2026
  • 1 reply
  • 34 views

Hi All!

I’d like to preface by saying I am a complete noob at scripting and appreciate any help I can get.

I am tasked with creating a document for work that maps from our core system.  The main mapped field is named “borrower(s) legal name(s)” which comes from a single application note in our core.  This means all borrowers have to be entered into one field, separated by entering to the next line, i.e. 4 borrowers the one mapped field would come over like this:

John Smith

Mary Smith

Joe Smith

Moe Smith

 

These names need to be split individually into 8 more fields on the last two pages, with each name having one line on each page, i.e second last page has borrower names, so.. Borrower 1=John Smith, Borrower 2 = Mary Smith, etc..  Last page has present party names for notary, i.e. Present Party 1 = John Smith, Present Party 2 = Mary Smith.

I created 4 fields (“legal1” “legal2” legal3” “legal4”) and added them to page 8 and 9 next to each corresponding name (Borrower 1 = “legal1”, Present Party 1 = “legal1”).  I then made the following script in “borrower(s) legal name(s)” 

for (var i=1; i<=4; i++) this.getField("legal"+i).value = "";
var lines = event.value.split("\r");
for (var i=0; i<lines.length; i++) this.getField("legal"+(i+1)).value = lines[i];

 

 

This works perfect and splits the 4 names from one field into each individual field.  Great, right?  Nope. We now have an employee who is stating that SOMETIMES the Present Part name wont be the same as the legal name and borrower 1 name, i.e. John Smith is incapacitated and has an agent signing for him, so the legal name and Borrower 1 name should be John Smith but in the notary section the Present Party name should be Tom Smith as agent for John Smith.

I cannot figure out how to allow them to edit one of those linked fields without changing the other.  If they back out the field in the Present Party section and change it to Tom Smith as agent for John Smith it automatically changes the Borrower 1 name because they are BOTH named “legal1”.

Is there any way I can accomplish this?  

Sorry if that doesn’t make sense, I can add a picture of what I mean if that is helpful!

    Correct answer Karl Heinz Kremer

    This is your original script (I reformatted and added braces for grouping):

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    }

     

    In the 2nd “for” loop, you can now just add another line to change the corresponding “present” field:

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    this.getField("present" + (i + 1)).value = lines[i];
    }

    If you only want to do that for the 1st value, you would need an “if” statement that would only do this when the “i” variable is set to 0:

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    if (i==0) {
    this.getField("present" + (i + 1)).value = lines[i];
    }
    }

     

    1 reply

    Karl Heinz  Kremer
    Community Expert
    Community Expert
    April 14, 2026

    If you have a calculated field, it will be calculated after something in the form changes - and that change could be you trying to change this specific field. The form will see the calculation event and will do its job. 

    You need a way to disable the calculation for this field. This could be for example an “Override” checkbox next to the field that would need to be activated so that your calculation script “knows” that it should not update this particular field. 

    I would go one step further and make the field read-only if this checkbox is not checked. When the user checks the checkbox, you would change it to editable, and make sure that it no longer gets updated. 

    For the two fields that have the same name - Acrobat considers them to be the same field, so if one changes, the other one will change as well. 

    You just apply the ‘override’ setting to one of these, but it would need a different name for this to work. 

    Does that make sense? 

    yanksgirl
    yanksgirlAuthor
    Inspiring
    April 14, 2026

    hmm...I think it does. 

    Do you know if there is a way in my script that I can split the lines from that first field into two separate sets of fields, but with the same data?  So like line 1 in the first field is John Smith - instead of having a field named “legal1” and just duplicating it on each of the last 2 pages, can I split line 1 to a field named “legal1” on page 8 and then “present1” on page 9?  So they would have the exact same data but be independent of each other so an employee can modify “present1” without it affecting the original field or “legal1”?

    Karl Heinz  Kremer
    Community Expert
    Karl Heinz KremerCommunity ExpertCorrect answer
    Community Expert
    April 14, 2026

    This is your original script (I reformatted and added braces for grouping):

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    }

     

    In the 2nd “for” loop, you can now just add another line to change the corresponding “present” field:

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    this.getField("present" + (i + 1)).value = lines[i];
    }

    If you only want to do that for the 1st value, you would need an “if” statement that would only do this when the “i” variable is set to 0:

     

    for (var i = 1; i <= 4; i++) {
    this.getField("legal" + i).value = "";
    }
    var lines = event.value.split("\r");
    for (var i = 0; i < lines.length; i++) {
    this.getField("legal" + (i + 1)).value = lines[i];
    if (i==0) {
    this.getField("present" + (i + 1)).value = lines[i];
    }
    }