Copy link to clipboard
Copied
Making a form which is 11 pages long on page 2 is Surname1 1st field Givenames1 2nd Field on page 11 I have a Name1 i want to combine the first 2 into the 3rd automatically. Really dont know what I am doing do I do script in the first 2 fields or just tell the 3rd field to look and enter info....thanks in advance
Hi its ok used this code and it worked perfectly.
event.value = this.getField("Givennames1").value + " " + this.getField("Surname1 ").value;
Thank you for your help
Copy link to clipboard
Copied
You can use a custom calculation script for the third field, something as simple as the following:
// Custom calculation script for Name1 field
(function () {
// Get the input field values, as strings
var s1 = getField("Surname1").valueAsString;
var s2 = getField("Givenames1").valueAsString;
// Combine strings, separated by a space, and set this field's value
event.value = s1 + " " + s2;
})();
It's not clear if this is how you want to combine the two field values, but it should get you started. Post again if you need more help and provide more specific info.
Copy link to clipboard
Copied
Hi this did not work does it matter about tab numbers and does it matter that the original field is on page 2 and the receiving field is on page 11. Where do I put the code in the 3rd tab.
Copy link to clipboard
Copied
Hi its ok used this code and it worked perfectly.
event.value = this.getField("Givennames1").value + " " + this.getField("Surname1 ").value;
Thank you for your help
Copy link to clipboard
Copied
comes back with Syntax error21: at line 22
Copy link to clipboard
Copied
Can you post the exact code you're using? What I posted is less than 22 lines, so you must be using something different. Also, exactly where did you place it?
Copy link to clipboard
Copied
I copied and pasted the code you showed. dont understand where i put it tried all places you can put javascript. If i upload the form would you be able to take a look. There is no sensitive information on the form.
Copy link to clipboard
Copied
As I mentioned, it is intended to be a custom calculation script for the Name1 field. You'll see where to add it on the Calculate tab of the field properties dialog. You should also remove it from where you've added it elsewhere.