Skip to main content
February 2, 2016
Answered

combines two text fields

  • February 2, 2016
  • 1 reply
  • 928 views

Hello , I created a form with Adobe pro XI . I want to create a text field that combines two text fields ( field1 and field2 ) . How can I do?

This topic has been closed for replies.
Correct answer George_Johnson

If the third field does not need to be editable, you can use a custom calculation script for it that is something like the following:

// Custom calculation script

(function () {

    // Get the field values, as strings

    var s1 = getField("Text1").valueAsString;

    var s2 = getField("Text2").valueAsString;

    // Set this field's value by concatenating the two strings

    event.value = s1 + s2;

})();

1 reply

Inspiring
February 2, 2016

You need to be more specific. Do you want to concatenate the field values as strings, and if so, do you want to include a separator between the two values? Or do you want to numerically add the two field values? Or something else? The more details you provide the better.

February 2, 2016

Yes, I have two string fields ( Text1 and Text2 ) and I would like to create a third field that combines " Text1Text2 " without other characters between them

George_JohnsonCorrect answer
Inspiring
February 2, 2016

If the third field does not need to be editable, you can use a custom calculation script for it that is something like the following:

// Custom calculation script

(function () {

    // Get the field values, as strings

    var s1 = getField("Text1").valueAsString;

    var s2 = getField("Text2").valueAsString;

    // Set this field's value by concatenating the two strings

    event.value = s1 + s2;

})();