Mercurial > urweb
comparison demo/nested.ur @ 455:d4a81273d4b1
Nested demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 04 Nov 2008 09:33:35 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
454:9163f8014f9b | 455:d4a81273d4b1 |
---|---|
1 fun pageA () = return <xml> | |
2 <head> | |
3 <title>A</title> | |
4 </head> | |
5 <body> | |
6 <form> | |
7 <table> | |
8 <tr> | |
9 <td>Forename:</td> | |
10 <td><textbox{#Forename}/></td> | |
11 </tr> | |
12 <tr> | |
13 <td>Enter a Surname?</td> | |
14 <td><checkbox{#EnterSurname}/></td> | |
15 </tr> | |
16 </table> | |
17 <submit action={fromA} /> | |
18 </form> | |
19 </body> | |
20 </xml> | |
21 | |
22 and fromA r = | |
23 let | |
24 val forename = r.Forename | |
25 | |
26 fun pageB () = return <xml> | |
27 <head> | |
28 <title>B</title> | |
29 </head> | |
30 <body> | |
31 <form> | |
32 Surname: | |
33 <textbox{#Surname}/> | |
34 <submit action={pageC'} /> | |
35 </form> | |
36 <a link={pageA ()}>Previous</a> | |
37 </body> | |
38 </xml> | |
39 | |
40 and pageC' r = pageC (Some r.Surname) | |
41 | |
42 and pageC surname = return <xml> | |
43 <head> | |
44 <title>C</title> | |
45 </head> | |
46 <body> | |
47 <p>Hello {[forename]}{case surname of | |
48 None => <xml/> | |
49 | Some s => <xml> {[s]}</xml>}</p> | |
50 {case surname of | |
51 None => <xml><a link={pageA ()}>Previous</a></xml> | |
52 | Some _ => <xml><a link={pageB ()}>Previous</a></xml>} | |
53 </body> | |
54 </xml> | |
55 in | |
56 if r.EnterSurname then | |
57 pageB () | |
58 else | |
59 pageC None | |
60 end | |
61 | |
62 val main = pageA |