blob: 31c9e1e8e50a6713dab3d1a195d3f4d205540fc8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
fun pageA () = return <xml>
<head>
<title>A</title>
</head>
<body>
<form>
<table>
<tr>
<td>Forename:</td>
<td><textbox{#Forename}/></td>
</tr>
<tr>
<td>Enter a Surname?</td>
<td><checkbox{#EnterSurname}/></td>
</tr>
</table>
<submit action={fromA} />
</form>
</body>
</xml>
and fromA r =
let
val forename = r.Forename
fun pageB () = return <xml>
<head>
<title>B</title>
</head>
<body>
<form>
Surname:
<textbox{#Surname}/>
<submit action={pageC'} />
</form>
<a link={pageA ()}>Previous</a>
</body>
</xml>
and pageC' r = pageC (Some r.Surname)
and pageC surname = return <xml>
<head>
<title>C</title>
</head>
<body>
<p>Hello {[forename]}{case surname of
None => <xml/>
| Some s => <xml> {[s]}</xml>}</p>
{case surname of
None => <xml><a link={pageA ()}>Previous</a></xml>
| Some _ => <xml><a link={pageB ()}>Previous</a></xml>}
</body>
</xml>
in
if r.EnterSurname then
pageB ()
else
pageC None
end
val main = pageA
|