Message Boards Message Boards

Newbie alert: FormFunction[] or FormObject[] How do I use it on Cloud?

Posted 11 years ago

This is my first post on this forum. Pardon me if it's a redundant question, but I've looked around and could not find any solution.

What I'm trying to do is create a fairly simple trivia game just to learn to code. My background is .NET, and I've tinkered with Python. I'm new to functional programming, but for some reason I am attracted to it.

I started learning how to make an interface and I came across FormObject[], and FormFunction[]. I can use CloudDeploy, and fill out the fields, but I don't know how to extract that information from the result of my input. In my world when I use a function, I would extract result of the function into a variable.

x = f[parameter]

But the result of this would be a copy of the form object.

x = CloudDeploy[FormFunction[{"Name" -> "String","Location" -> "String"}, f]]

x would equal the same as if you were to hit Shift-Enter on the line above.

In the documentation, the example code is something like this. FormFunction[{"Name" -> "String","Location" -> "String"}, f]

I know that f is a function, and I could do some neat things with that function, but I have no idea how to get the input into a variable other than in this format (or something like it) <|"Name" -> "Casey","Location" -> "Earth"|> And I'm lucky if I can get that far. When I use CloudDeploy the result is a web page that has <|"Name" -> "Casey","Location" -> "Earth"|> displayed. Not very useful.
Surely there is some way to get this, I'm thinking Interpreter or some other function.

So I basically have two questions. 1. Should I use FormFunction, or FormObject in my above scenario if it matters? 2. How can I get one item in the list that is the result instead of this hairy monster <|"Item1","Item2|>.

Thanks in advance.

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