blob: 46668cf85073b50a852de235b33cd8262c42ffea (
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
|
table t : {Id : int}
cookie c : int
fun setter r =
setCookie c (readError r.Id);
return <xml>Done</xml>
fun writer () =
ido <- getCookie c;
case ido of
None => error <xml>No cookie</xml>
| Some id => dml (INSERT INTO t (Id) VALUES ({[id]}))
fun preWriter () = return <xml><body onload={onConnectFail (alert "RPC error")}>
<button onclick={writer ()} value="Write to database"/>
<a link={main ()}>Back</a>
</body></xml>
and main () = return <xml><body>
<form>
<textbox{#Id}/> <submit value="Get cookie" action={setter}/>
</form>
<form><submit action={preWriter} value="Prepare to write to database"/></form>
</body></xml>
|