Solved: How to fill a SingleSelectDropdown with a fusion array

Hi everybody,

I’m rendering a form with

<form:render persistenceIdentifier="modul-registration-form"
  overrideConfiguration="{renderables:{0:{renderables:{0:{properties:{options:myDates}}}}}}"/>

myDates is built from a node property of type text that has multiple lines where each line has a date. In my fusion I’ve got the following line:

myDates = ${String.pregSplit(daysAvailable, '/\n/')}

So I get the following array, which is perfect overridden in my form:

myDates = {
  0 => dateAvailable1, 
  1 => dateAvailable2, 
  2 => dateAvailable3
}

This works fine so far. But I’m stuck here.
The first problem I have to solve, is that my array should look like this:

myDates = {
  dateAvailable1 => dateAvailable1,
  dateAvailable2 => dateAvailable2,
  dateAvailable3 => dateAvailable3
}

I was trying to solve this with:

myDates = ${Array.map(String.pregSplit(daysAvailable, '/\n/'), x => {x=>x})}

and:

myDates = ${Array.map(String.pregSplit(daysAvailable, '/\n/'), x => x)}

Both versions don’t help.

The 2nd problem: I have another field with daysBooked which has the same format as daysAvailable. The result should be an option list that is sorted where daysBooked should get the attribute disabled in the final dropdown.

Is it possible to solve this problem in fusion or do I have to go a different way?

After viewing codes and documentation, I couldn’t find a possibility to add opions to SingleSelectDropdown that carry the disabled attribute. :cry:

Therefore, I changed the code to load the options with JavaScript when form gets displayed.