Skip to main content
Inspiring
November 25, 2025
Answered

Script for creating an email in another textbox

  • November 25, 2025
  • 3 replies
  • 380 views

Hi all,

 

I'm looking to create this situation in two separate textboxes:

Input - BoxA: "JOHN SMITH"

Output - BoxB: "JSMITH@EMAIL.COM"

 

is this possible?

Correct answer PDF Automation Station

Enter the following custom calculation script in BoxB:

event.value="";
var name=this.getField("BoxA").value;
if(name && name.split(" ").length>1)
{event.value=name.split("")[0]+name.split(" ")[1]+"@email.com"};

3 replies

try67
Community Expert
Community Expert
November 25, 2025

What about if there are multiple names? You can't know if they are first names, middle names, last names, etc.? What about initials? What about hyphenated names? There are many variables you didn't consider with this, I think.

Inspiring
November 26, 2025

For someone else, I can absolutely understand where those factors need to be considered. However, for me, I got exactly what I needed it to be.

PDF Automation Station
Community Expert
Community Expert
November 26, 2025

Another way to do this (if there is a set list of names and corresponding email addresses) is to have a dropdown containing the list of names, with email addresses as the corresponding export values.

JR Boulay
Community Expert
Community Expert
November 25, 2025

Use this as a Validation script in BoxA:

if (event.value != "") {this.getField("BoxB").value = event.value + "@email.com";}
else {this.getField("BoxB").value = "";}
Acrobate du PDF, InDesigner et Photoshopographe
Inspiring
November 25, 2025

This is what I'm getting, so not quite what I'm looking for.

 

I need the first letter of the first word in BoxA and the entire second word in BoxA.

PDF Automation Station
Community Expert
Community Expert
November 25, 2025

Enter the following custom calculation script in BoxB:

event.value="";
var name=this.getField("BoxA").value;
if(name && name.split(" ").length>1)
{event.value=name.split("")[0]+name.split(" ")[1]+"@email.com"};
PDF Automation Station
Community Expert
Community Expert
November 25, 2025

What do you mean by "Output"?

Inspiring
November 25, 2025

After the script or formula, that is what I'd like to appear in BoxB.