How to | Create an Instant Web Form

An instant web form lets you call Wolfram Language code in the Wolfram Cloud from a web form. You create an instant web form using the Wolfram Language functions FormFunction and CloudDeploy. Instant web forms can be private (so only you can use them) or public (so anyone can use them). Note: running an instant web form uses Wolfram Cloud Credits from your account.

This sets up an instant form that will call a function to generate "Hello, world" at a specified size:

Go to a web browser to use the form:

Here is the result from submitting the form:

    

An instant form requires three basic things: a specification of parameters and their types, a specification of the code the form should run, and a specification of how the result from the form should be returned.

The Wolfram Language supports many types of parameters, as listed here.

This creates an instant web form that has a parameter called "name" representing a country and that returns a PNG:

The form on the web:

The result from submitting the form:

    

You specify the code for an form to run as a pure function, with parameter names given as #name and an & at the end to indicate that it is a pure function.

This deploys an instant form that uses parameters x and y as numbers and whose code adds these numbers together:

    

You can specify permissions for a form deployment; this makes the form public:

    

Different parameter specifications yield different types of input fields. This is the result for a "Color" parameter:

Many parameter specifications yield "smart fields" indicated bythat allow natural language input:

    

Use a list to include a label for a field:

Use another rule to include a default:

Restricted restricts the range of a parameter:

    

FormFunction automatically sets up appropriate controls:

    

Use the PageTheme option to change the overall look of a form:

    

The Wolfram Language provides detailed control for the appearance of forms and fields. Use FormObject to specify the basic appearance of a form, then use the FormLayoutFunction option to specify how to render it on the web.