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:

In[1]:=
Click for copyable input
Out[1]=

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 representing a country and that returns a PNG:

In[1]:=
Click for copyable input
Out[1]=

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 and an at the end to indicate that it is a pure function.

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

In[1]:=
Click for copyable input
Out[1]=
    

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

In[1]:=
Click for copyable input
Out[1]=
    

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:

In[1]:=
Click for copyable input
Out[1]=

Use another rule to include a default:

In[2]:=
Click for copyable input
Out[2]=

Restricted restricts the range of a parameter:

In[3]:=
Click for copyable input
Out[3]=
    

FormFunction automatically sets up appropriate controls:

In[1]:=
Click for copyable input
Out[1]=
    

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

In[1]:=
Click for copyable input
Out[1]=
    

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.