Expand my Community achievements bar.

SOLVED

Populate a list with previously gathered data

Avatar

Level 4

I would like to populate a dropdown list with data previously gathered within the same form. How do I do this?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There are a variety of ways. For example, if 'stooges' is a drop-down list and 'stoogeName'  is a text field, you could put the following JavaScript on the exit event of 'stoogeName',

// form1.page1.subform1.stoogeName::exit - (JavaScript, client)

form1.page1.subform1.stooges.addItem(this.rawValue);

Steve

View solution in original post

5 Replies

Avatar

Correct answer by
Former Community Member

There are a variety of ways. For example, if 'stooges' is a drop-down list and 'stoogeName'  is a text field, you could put the following JavaScript on the exit event of 'stoogeName',

// form1.page1.subform1.stoogeName::exit - (JavaScript, client)

form1.page1.subform1.stooges.addItem(this.rawValue);

Steve

Avatar

Level 4

That worked! Thank you very much!

Avatar

Level 4

Another related question -

How do I make the data populate in subsequent instances of that dropdown list?

Avatar

Former Community Member

That depends on the structure of your form and the binding properties for the drop-down. If each page, sub-form, and drop-down is named explicitly you will have to replicate the script for each unique instance of the drop-down. Otherwise, I would have to see the form.

Steve

Avatar

Level 4

I guess they all are uniquely named because they are in different subforms. I can't use fragments because I need unique data values, right?

Here is my form.

You can see the qobj subform repeat.

The qaddobj_btn calls the instance manager.

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] ----