1

I want to be able to use FormPage (or FormFunction) to be able to create an Association List for later use in a notebook. This should be very easy to do since FormFunctionessentially creates this Association List automatically for use with Pure Functions in the code.

Something as simple as this creates the output I am after:

FormPage[{"First Name" -> "String", "Last Name" -> "String"}]

I would think that I could achieve what I was looking for with something like this:

FormPage[{"First Name" -> "String", "Last Name" -> "String"}, names =]

And the ideal output would simply be:

names=<|"First Name"->"Bob","Last Name"->"Jones"|>

But, the lack of definition of the variable in the function definition argument of FormPage causes Mathematica to return an error without evaluating.

I did try the following hoping for a better result:

FormPage[{"First Name" -> "String", "Last Name" -> "String"}, names =#&]

But then when I call names I simply get an output of:

#1 &

Surely I am missing something very simple here.

kickert
  • 1,820
  • 8
  • 22

1 Answers1

1
FormPage[{"First Name" -> "String", "Last Name" -> "String"}, (names = #)&]

enter image description here

names

<|"First Name" -> "qwerty", "Last Name" -> "asdfgh"|>

kglr
  • 394,356
  • 18
  • 477
  • 896