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]:=
![Click for copyable input](assets.en/create-a-dynamic-webpage/In_1.png)
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.
![](assets.en/index.en/GB_1.png)
Entering a number will update the page.
![](assets.en/index.en/GB_2.png)
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]:=
![Click for copyable input](assets.en/create-a-dynamic-webpage/In_2.png)
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.
![](assets.en/index.en/GB_3.png)
![](assets.en/index.en/GB_4.png)