Combining two fields into one
Hi, I’m creating a document with multiple forms. I’m having issues with combining the natural mother’s name and natural father’s name in a field.
On one form the names are three separate fields so I have named the fields as follows for mom’s complete name: NMFirst, NMMiddle, NMLast.
I did the same for the father’s name: NFFirst, NFMiddle, NFLast.
On another form there is one field for each parent’s complete name. For the mother I combined all three fields into one, naming that field NMName.
Again the same was done for the father, I named that field NFName.
Here is where I have run into an issue. Another form is a letter and in the address block it should have the mother’s complete name and the father’s complete name.
This is my coding:
var nm = this.getField("NMName").valueAsString; //natural mother’s full name
var nf = this.getField("NFName").valueAsString; //natural father’s full name
if (nf =="")event.value = nm; //if no natural father, show natural mother’s name only
else event.value = nm + " and " + nf; //this should show natural mother’s name and natural father’s name
This works fine until there is no natural father’s name and the result is the natural mothers name and the word “and”
Example: Megan Michelle Wright and
I’ve been looking at this for a while and trying different things to remove the word “and” but I think I’m just stuck. Thank you.
