# How to place a FormFunction in DialogInput?

FormFunctions work well in a notebook cell.

ff = FormFunction[{{"Count" -> "Number"}, {"Stuff" -> "String"}}, Identity];
ff[]


The following displays the FormFunction in the notebook and then the dialog with the result of the function.

DialogInput[ff[]]


How are they used in DialogInput? I would like to create a dialog with the function and have it return the results of the function to the notebook.

For a single page:

DialogInput[{x}
, FormControl[
Dynamic[x, DialogReturn]
, FormObject[{"Count" -> "Number", "Stuff" -> "String"}]
]
]


for a multipage, this is a very simple example but if it works for you we can try to generalize it:

Association[
FormControl[
Dynamic[x, DialogReturn],
FormObject[##]
]
] & @@@ {{"Count" -> "Number",
AppearanceRules -> <|"SubmitLabel" -> "Next"|>}, {"Stuff" ->
"String"}}
]


So there is a limit to crazyness due to the fact that DialogInput is blocking the kernel but we can launch separate dialogs for each page.

• Interesting solution but it does not include one of the key features of multi-page forms. That being the ability to pass-through the collection of previous selected values from all prior pages to the current page. For example FormFunction[{{"Stuff" -> "String"}, {"PreSelected" -> <|"Input" -> #["Stuff"]|>} &}] Mar 5, 2018 at 14:04
• @Edmund I see, we can work it out I think, it is just a matter of the flow. E.g. instead of @@@ you can Fold dialog over pages specs so it can access previous answers. Or to keep currentState in an outer module and have it accessible for each inputDialog.
– Kuba
Mar 5, 2018 at 14:13
• @Edmund I don't have time for it now but if you add a full example you'd like to be supported I will try to edit the answer sometime in near future, assuming you are fine with repeated dialog.
– Kuba
Mar 5, 2018 at 14:14
• An actual example can be found here Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"]["http://i.stack.imgur.com/fh9zf.png"] I sent this to WRI support but they have not provided any workarounds as yet. Mar 6, 2018 at 15:14
• Is there a way to get it to show using DialogNotebook instead of DialogInput? I tried the obvious but it still places the form in the evaluation notebook. Mar 6, 2018 at 15:27