Add an Arbitrary Number of Fields to a Form
Sometimes there is no way of knowing how many fields will be necessary for a form in FormFunction. RepeatingElement allows you to create a super-field that can contain several lines.
In[1]:=
![Click for copyable input](assets.en/add-an-arbitrary-number-of-fields-to-a-form/In_9.png)
CloudDeploy[
FormFunction[
"addresses" -> RepeatingElement["StreetAddress", {2, 5}],
GeoGraphics[
Append[GeoMarker /@ #addresses,
Style[Line[TravelDirections[#addresses]], Thick, Red]]] &,
AppearanceRules -> <|
"Title" -> "Get travel directions for your trip"|>]]
The form starts out with two fields; you can click the plus sign to get more.
![](assets.en/index.en/GB_12.png)
![](assets.en/index.en/GB_13.png)
Submit the form to see the map of your trip.
![](assets.en/index.en/GB_14.png)