I have an Association of string keys and numerical values, which is read from a configuration file. I would like to allow users to drag sliders and adjust the numerical values according to their preferences and re-run computations. However, the formfunc in FormPage does not get the new values upon submission. The computations only ever receive the default values read from the configuration file.
The following MWE illustrates the problem:
RightComposition[
(*The line below simulates the result of reading the configuration file*)
CharacterRange["a", "h"] &, AssociationMap[RandomInteger[{1, 64}] &],
(*The functions below generate the FormPage with sliders*)
KeyValueMap[With[{s = #1, t = #2},
Rule[s, Rule[
Association[{
"Interpreter" -> Restricted["Real", {0, 100}],
"Control" -> (Slider[t, {0, 100, 0.5}, Appearance -> "Labeled"] &)
}],
t
]]
] &],
FormPage[#, Identity] &
][]
Note that dragging around the sliders does not change the values that are submitted. The resulting Association is always the same as the initial one.
What am I doing incorrectly?
Partial workaround
Just in case someone else has encountered this problem and is about to waste a lot of time trying to figure out a solution: the only bad approximation I could construct was to change the KeyValueMap above to the following:
KeyValueMap[(#1 -> Table[i, {i, 0, 100, 0.5}] -> #2) &]
In order words, I have had to remove sliders and use drop-downs instead.