Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Adaptive Form - Dropdown selection create fields with preselected data

kjbrereton
Level 1
Level 1

Hello, hoping someone can help/give some ideas.

I have part of an adaptive form where a dropdown field selection needs to populate 3 other fields, 1 of these fields with multiple selections.

the usecase is:

  • I have 3 lists - "Procedure", "Positives", Negatives"
  • Make multiple selections from "Procedure"
  • Each "Procedure" has multiple predetermined selections from the other lists "Positives" and "Negatives"
  • Selected "Procedure(s)" to populate 2 fields "Positives" and "Negatives" with combined selections from respective lists (overlaps can occur, filter out duplicate selections) (so the data can be collected)
  • Ability to remove selections from "Positives" and "Negatives" before form is submitted (does not modify existing list, just adhoc change)
  • Display the selected "Procedure" with corresponding selections on a Document of Record
  • Capture the data of selected "Procedure" with corresponding selections.

My current attempt is through script:

  • I have 3 lists
  • 'value commit' script - switch
  • each case to 'push' items into 2 different arrays (positiveArray, negativeArray)
  • a function with parameters (inputArray, inputPanel, inputField) to:
    • Filter array for duplicates
    • Clear panel instances
    • Create new instances per number of items in array
    • Populate each field of new instances with contents of the array
  • The 'selections' / lists will be stored as JSON in an external db for easier maintenance
  • Another idea was to load the selections from XML files
  • I have also looked at the Coral UI - Multiple Selection with Preselected Items - I like how this looks, compact and easy to use - however don't know how to use with an adaptive form

Can anyone help with a solution?  Should I be thinking about this a different way?

Many thanks!

1 Reply
kautuk_sahni
Community Manager
Community Manager

Moving this thread to AEM Forms.

~kautuk