Create a Dynamic Webpage
FormPage works in many ways like FormFunction, but it keeps the form above the result, so that you can keep interacting with it.
In[1]:=
CloudDeploy[
FormPage[{"n", "Please enter the number of sides"} ->
Restricted["Integer", {3, Infinity}],
Graphics[RegularPolygon[#n]] &]]
You can visit the page to interact with it: at first no result is shown.
Entering a number will update the page.
You can improve the FormPage by changing the default controller and the placement of the elements. AutoSubmitting is also useful if you want the page to update whenever a field is changed.
In[2]:=
CloudDeploy[
FormPage[{"n", "Please enter the number of sides"} ->
AutoSubmitting[<|"Interpreter" -> Restricted["Integer", {3, 20}],
"Control" -> Slider|>],
Graphics[RegularPolygon[#n]] &, {"Form"} -> {"Form", "Result",
"Form"}]]
Visit the resulting page.