Hi there, I'm suing the Advanced Forms API Plugin. In a form, I&

Hi there,

I'm suing the Advanced Forms API Plugin. In a form, I'm displaying a dynamic dropdown using the populateDropdown function. The data i'm displaying (and the corresponding values) is of type 'text'.
My problem is that on load of the form, the dropdown always displays the top level item, and is refusing to use the default item that I'm telling the field to use.
For example: if the default item for the field is third in the list of items that the dropdown displays, it will still by default display the first item, even though the third item seems to be available in the dropdown.

Is using a default value in combination with the populateDropdown function possible? If so, would you be able to let me know how you're doing it?

Thanks!...

OriginalPostID-98437

OriginalPostID-98437

  Discussion posts and replies are publicly visible

Parents
  • You could add an additional argument (numeric) to the populateDropdown() function and keep passing it until it reaches FormAPI.updateDropdownValues() and assign that index to the "selected" attribute of the "choices" variable.

    Just remember that this will require you to replace the JS file that comes inside the Advanced Form Utilities JAR and that you should document that as a new version for it to be deployed in other environments and avoid inconsistent behavior.
Reply
  • You could add an additional argument (numeric) to the populateDropdown() function and keep passing it until it reaches FormAPI.updateDropdownValues() and assign that index to the "selected" attribute of the "choices" variable.

    Just remember that this will require you to replace the JS file that comes inside the Advanced Form Utilities JAR and that you should document that as a new version for it to be deployed in other environments and avoid inconsistent behavior.
Children
No Data