Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Concatenate - how to get rid of defult "null null" values in field.

Avatar

Level 2

I have successfully concatenated the first and last name fields in form design but when I open/run the form the concatenated field (FullName) defaults to "null null" on theForm Design.png form. I want it to be blank until the user enters data in the FirstName and LastName fields.

I am not an experienced Java scripter and need to have the full script exactly as it needs to be entered from start to finish.

Here is what is in the script editor the current script:

form1.Subform1.FullName::calculate - (JavaScript, client)

var first = form1.Subform1.FirstName.rawValue;

var last = form1.Subform1.LastName.rawValue;

this.rawValue = first + " " + last;

LiveCycle Designer ES2

Windows 8

Message was edited by: PenEliz1 I added a screen shot.

1 Accepted Solution

Avatar

Correct answer by
Level 5

You just need to do a Null check .

var first = form1.Subform1.FirstName.rawValue;

var last = form1.Subform1.LastName.rawValue;

if(first != null && last != null){

this.rawValue = first + " " + last;

}

Vjay

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

You just need to do a Null check .

var first = form1.Subform1.FirstName.rawValue;

var last = form1.Subform1.LastName.rawValue;

if(first != null && last != null){

this.rawValue = first + " " + last;

}

Vjay

Avatar

Level 2

Thanks. Copied your code but at first didn't work but realized that in copying, some spaces were added that when deleted, resulted in the form working they way I wanted it to.

Avatar

Level 1

Hi I have just used the same code but have come across a problem. If someone deletes or changes an entry in one of the fields, it doesn't change the full name field back. any ideas?