Expand my Community achievements bar.

SOLVED

Collecting the data from different fields into one text box

Avatar

Level 3

Hi,

I just created a form with 4 pages. At the 1st page, Surname, Given Name and Middle Name fields are located. I'd like to put a field to the page4 which will collect the student's full name from these 3 fields as you can see in the picture below. The result will be viewable and printable only. How can I do that?

Thank you

name.jpg

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You can do something like this....

// form1.page2.subform1.fullName::calculate - (JavaScript, client)

var surname = "";

var firstName = "";

var middleName = "";

if (!(form1.page1.subform1.surname.isNull)) {

  surname = form1.page1.subform1.surname.rawValue + ", ";

}

if (!(form1.page1.subform1.firstName.isNull)) {

  firstName = form1.page1.subform1.firstName.rawValue;

}

if (!(form1.page1.subform1.middleName.isNull)) {

  middleName = form1.page1.subform1.middleName.rawValue;

}

this.rawValue = surname + firstName + " " + middleName;

Steve

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

You can do something like this....

// form1.page2.subform1.fullName::calculate - (JavaScript, client)

var surname = "";

var firstName = "";

var middleName = "";

if (!(form1.page1.subform1.surname.isNull)) {

  surname = form1.page1.subform1.surname.rawValue + ", ";

}

if (!(form1.page1.subform1.firstName.isNull)) {

  firstName = form1.page1.subform1.firstName.rawValue;

}

if (!(form1.page1.subform1.middleName.isNull)) {

  middleName = form1.page1.subform1.middleName.rawValue;

}

this.rawValue = surname + firstName + " " + middleName;

Steve

Avatar

Level 3

Terrific! Thanks very much Steve, you saved my day

Regards

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----