Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

global data dropdown populated with user-entered data

Avatar

Level 2

I've been trying to solve a specific problem from the bottom up, but perhaps someone else has a better idea on how to structure the whole thing, so it might be more useful to describe what I'm trying to accomplish.

I have a dynamic table with a single text field.  One entry per line, and users can add as many lines as they need.  The data that's entered into that table at the beginning of the form needs to be used in multiple dynamic tables throughout the rest of the form.

Ex (yes, not real code, just illustrating the format):

Table 1 - Widget

<textfield>widget</textfield>

addRow     deleteRow

Table 5 - Size

<dropdown>widget</dropdown>     <textfield>size</textfield>

addRow     deleteRow

Table 8 - Cost

<dropdown>widget</dropdown>     <textfield>productionCost</textfield>

addRow     deleteRow

So far I've been able to pull the values out of table 1 and pull them into a dropdown list in table 5, but any attempt to turn the dropdown into a global data object breaks everything, and the coding is complicated enough that it's not terribly feasible to create 30 functions in the document to individually pull the same data into each table's dropdown list.  I was thinking maybe an embedded XML schema could be populated on the fly from table 1, then the dropdowns could be bound to that internal list for the list items, but I have no idea how to create that sort of setup.  Everything has to be self-contained within the form, so I can't send it to an external database and then call it back in.

My other option is to just dump the most common choices into the dropdown and let the user enter anything unusual, but I know from experience that results in some widgets not being entered in later tables because the user forgets exactly what they added to this specific form.

3 Replies

Avatar

Level 10

Hi,

Global binding will not work for objects (including Dropdowns) in repeating rows. This is because while the object appears in different rows (different instances of the repeating row), they all have the same name.

There is an example here, which minics global binding in repeating rows: http://assure.ly/eTOXaH. See the script in the exit event of the objects in the first table. Please note that this example is set up so that the number of rows is the same in both tables.

Hope that helps,

Niall

Avatar

Level 2

I get what you're saying.  Unfortunately, this solution won't help me because there's a 1∞many relationship - the entries in the first table are unique, but in subsequent tables, the individual data entries may be used once, multiple times, or not at all.

Is there perhaps a way to funnel the data from table 1 into a variable I can then pull into the individual dropdown lists on a one-off basis?

Avatar

Level 10

Hi,

You can loop through Table1 and then populate the dropdown in Table2 using this data. You would have script in the preOpen event of the dropdown in Table2.

Here are some examples of populating dropdowns:

http://assure.ly/KXAUg5

http://assure.ly/jcTahK

http://assure.ly/mP5Lud

Here is an example for looping through repeating rows:

http://assure.ly/haaOfc

Lastly, here is an example for referencing objects, which will be useful for using the XFA.resolveNodes() method:

http://assure.ly/kUP02y

Hope that helps,

Niall