Expand my Community achievements bar.

Dropdown list populates 6 other drop down lists

Avatar

Former Community Member

Hi is there anyway I can populate 6 dropdown lists from another dropdown list? Can I use Global Binding if the 6 dropdown boxes are the same name?

This work on the first dropdown but not subsequent ones.

Capture.PNG

1 Reply

Avatar

Level 10

Hi,

You can't use global binding as that only works with the value of the drop down, not the actual list.  You can use a predicate binding, so if I had some xml like

<Languages>

  <currentLanguage>1</currentLanguage>

  <Language id="1" display="English"/>

  <Language id="2" display="French"/>

  <Language id="3" display="Maori"/>

  <Words>

    <Word language="1" id="1">one</Word>

    <Word language="1" id="2">two</Word>

    <Word language="1" id="3">three</Word>

    <Word language="1" id="4">four</Word>

    <Word language="2" id="1">un</Word>

    <Word language="2" id="2">deux</Word>

    <Word language="2" id="3">trois</Word>

    <Word language="2" id="4">quatre</Word>

    <Word language="3" id="1">tahi</Word>

    <Word language="3" id="2">rua</Word>

    <Word language="3" id="3">toru</Word>

    <Word language="3" id="4">whā</Word>

  </Words>

</Languages>

The first dropdowns list is bound to the Language element with $record.Language[*] and the value of the dropdown bound to $data.Languages.currentLanguage.value, the dependent dropdowns could be bound to the appropriate Word elements with $data.Languages.Words.Word.[language == $data.Languages.currentLanguage.value].

This way the only actual code you will need is a xfa.form.remerge() in the exit event of the language drop down.  Using remerge() will mean any form properties that have been updated by script will have to be re-applied.  This tends to be things like error highlighting or calculated values that are not bound to the data connection.

I have a sample of this approach here, https://workspaces.acrobat.com/?d=JEiwbw2GgRngqwL8umw8Og and some xml to preview it here https://workspaces.acrobat.com/?d=nXh795dIs8DLJ2erx5j1QA

Regards

Bruce