Skip to main content
Participant
November 20, 2018
Answered

Combine 2 fields into 1

  • November 20, 2018
  • 1 reply
  • 792 views

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

This topic has been closed for replies.
Correct answer aussieinsurea40673755

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

1 reply

Inspiring
November 20, 2018

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.

Participant
November 21, 2018

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.

aussieinsurea40673755AuthorCorrect answer
Participant
November 21, 2018

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