# Need examples of multipage FormFunction\[\]

**URL:** <https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617>\
**Category:** Questions\
**Tags:** wolfram-cloud, wolfram-engine\
**Created:** [January 24, 2015, 12:50pm UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617 "2015-01-24T12:50:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spolonsky](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/spolonsky/32/23721_2.png) [@spolonsky](https://community.wolfram.com/u/spolonsky)\
**Post date:** [January 24, 2015, 12:50pm UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617/1 "2015-01-24T12:50:05Z")

</div>

Dear community,  
FormFunction has a multipage option FormFunction[{formspec1,formspec2,},func,]. I wonder if it is possible to use values from formspec1 to preset the values of formspec2? Any example would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![chadk](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/chadk/32/12238_2.png) [@chadk](https://community.wolfram.com/u/chadk)\
**Post date:** [January 30, 2015, 5:57pm UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617/2 "2015-01-30T17:57:40Z")

</div>

Stas, apologies for the slow response. I was trying to think of ways that this can be done, but I don’t think it is possible. UPDATE: Very possible. See my reply below.

An alternative solution would be to use separate FormFunctions. but this is not nearly as “clean”. Here is a trivial example.

```
a2 = CloudDeploy[ FormFunction[{"x" -> {"cat", "person"}}, 
   Switch[#x, "cat", HTTPRedirect[First@cat], "person", HTTPRedirect[First@person]] &]]

```

Where I have previously defined (and deployed) the secondary forms:

```
cat = CloudDeploy[FormFunction[{"x" -> "CatBreed"}, #x["Image"] &, "PNG"]]

```

and

```
person = CloudDeploy[FormFunction[{"person" -> "Person"}, #person["BirthDate"] &]]

```

---

<div class="post-metadata">

**Author:** ![spolonsky](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/spolonsky/32/23721_2.png) [@spolonsky](https://community.wolfram.com/u/spolonsky)\
**Post date:** [February 8, 2015, 11:26am UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617/3 "2015-02-08T11:26:27Z")

</div>

Thank you, Chad! I would still like to explore the multipage FormFunction[] options to get a “clean” solution. The Wolfram Programming Cloud documentation says:

FormFunction[{formspec1,formspec2,},func,]  
represents a multipage form, in which the successive formspec\_i can be functions that are applied to the values obtained so far.

I wonder if you could give me an example, illustrating the above statement.

Thanks in advance,  
Stas

---

<div class="post-metadata">

**Author:** ![chadk](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/chadk/32/12238_2.png) [@chadk](https://community.wolfram.com/u/chadk)\
**Post date:** [February 9, 2015, 3:09pm UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617/4 "2015-02-09T15:09:58Z")

</div>

My apologies. I didn’t read the documentation carefully enough. Note that it says that forms are pure functions that are applied to an association of previous input. So just define the subsequent forms explicitly as pure functions.

Here are some simple examples:

```
FormFunction[{{"x" -> "Number"}, {"y" -> {#x , 2, 3} } &}, {#x, #y} &][]

```

and

```
FormFunction[{{"x" -> {"cat", "actress"}}, {Switch[#x, "cat", 
     "y" -> "CatBreed", "actress", 
     "y" -> {Entity["Person", "AnneHathaway::fkdf7"], 
       Entity["Person", "HalleBerry::hj23z"], 
       Entity["Person", "LeeMeriwether::863fn"]}]} &}, #y["Image"] &, "PNG"]

```

---

<div class="post-metadata">

**Author:** ![spolonsky](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/spolonsky/32/23721_2.png) [@spolonsky](https://community.wolfram.com/u/spolonsky)\
**Post date:** [February 13, 2015, 11:49am UTC](https://community.wolfram.com/t/need-examples-of-multipage-formfunction/4617/5 "2015-02-13T11:49:02Z")

</div>

Thank you, Chad! This does answer my question.
