Message Boards Message Boards

3
|
8784 Views
|
10 Replies
|
6 Total Likes
View groups...
Share
Share this post:

Persistence in FormFunction

Right now, I have a form function that works fine. (It needs a lot of polish, but the basics are there). I've created the CloudObject using CloudDeploy and it all works. BUT ... The behavior I would like is for the form to return an answer AND a new copy of the form so that the user can twiddle with the inputs. The user thus works with the form interactively. I know this is probably a dumb question, but what do I do?

form = FormFunction[{"ev" -> 
    Association["Interpreter" -> "Expression", "Required" -> False], 
   "f" -> Association["Interpreter" -> "Expression", 
     "Required" -> False], 
   "t" -> Association["Interpreter" -> "Expression", 
     "Required" -> False], 
   "iso" -> 
    Association["Interpreter" -> "Expression", "Required" -> False], 
   "nd" -> Association["Interpreter" -> "Expression", 
     "Required" -> False]}, 
  N@Switch[NumericQ /@ {#ev, #f, #t, #iso, #nd}, {False, True, True, 
      True, True}, 
     ev[#f, #t, #iso, #nd], {True, False, True, True, True}, 
     f[#t, #ev, #iso, #nd], {True, True, False, True, 
      True}, {t[#f, #ev, #iso, #nd], 
      reciprocalT[#f #ev, #iso, #nd]}, {False, False, False, True, 
      False}, iso[#f, #t, #ev, #nd], {True, True, True, True, False}, 
     nd[#f, #t, #ev, #iso], _, Missing[]] &, 
  AppearanceRules -> 
   Association["Title" -> "Exposure Calculator", 
    "Description" -> "Enter any four values and press submit"], 
  FormTheme -> "Blue"]
POSTED BY: Seth Chandler
10 Replies

Have you seen FormPage ?

CloudDeploy[FormPage["country" -> "Country", GeoGraphics[#country] &]]

enter image description here

POSTED BY: Vitaliy Kaurov

The application is live for the summer school. You can see it by clicking Apply Now. Alison Kimball is really responsible for it.

The basic steps were to setup the fields in a FormObject, which look like

"name" -> <|"Label" -> "First name *", "Control" ->  InputField,  "Interpreter" -> "String"|>,

and then make a function for what happens when someone clicks Submit. For this application, we want to make a rudimentary check of the inputs, then save in a databin with DatabinAdd and also SendMail (for the sake of redundantly saving the application in email archives, which also serves as an institutional continuity to the past).

Note: the summer school page is not updated to this year's information. We were able to put up the application earlier because we could simply put it on the cloud. I'll explain further in another thread.

POSTED BY: Todd Rowland

Persistence in FormFunction

POSTED BY: Sean Clarke

Thanks, Vitaly, obviously I had not.

POSTED BY: Seth Chandler

I only just learned about this yesterday from Stephen's new book for beginners! Something for everyone in there...

POSTED BY: David Reiss

Thanks Seth for posting this question.

We were using FormFunction to make applications to the Wolfram Summer Programs (e.g. the summer camp for high schoolers and the summer school for researchers/innovators/educators) and then reading this, realized that FormPage would be better. If someone makes a typo they can easily fix it compared to retyping the whole application when using FormFunction.

P.S. The applications should be up soon.

POSTED BY: Todd Rowland

Hello Todd,

I'm working on cloud deploying similar forms and will be very interested to see how well FormPage works for you. For example, do all your application fields fit on a single FormPage?

Maybe we can only say how well it works once people start applying (the application isn't live yet).

Your technical question about chaining the FormPages, I don't know for sure. The documentation for building web applications explains how to link these together, and I don't know if this has been updated to include FormPage. I would expect that you can do it by passing arguments to the url that the FormPage produces in a similar way to FormFunction.

One approach we are taking for application homework-style questions is to store data in DataDrop. This will allow students to save their work and come back later to answer more questions.

POSTED BY: Todd Rowland

I assume that you are referring to the multipage FormFunction, see the last two items of the Details and Options section of the FormFunction documentation. This is what I'm using.

I look forward to seeing what you come up with for the Summer School application!

Alison has done great work putting the summer school application in the Wolfram Cloud!

A Wolfram Blog post on the making of the summer school application could be very helpful to people developing other Wolfram Cloud programs. Perhaps you could include an overview of the code and further details on the use of FormObject, Databin, SendMail, etc.

A single FormFunction page probably makes the most sense for the summer school application because the applicant can easily go back and forth reviewing and editing all fields before submitting the application. If for some reason it makes more sense to split a future summer school application across multiple pages, I just posted a Wolfram Community question on this topic:

Edit input on previous pages of multipage FormFunction?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract