summaryrefslogtreecommitdiff
path: root/demo/cookie.ur
diff options
context:
space:
mode:
Diffstat (limited to 'demo/cookie.ur')
-rw-r--r--demo/cookie.ur26
1 files changed, 26 insertions, 0 deletions
diff --git a/demo/cookie.ur b/demo/cookie.ur
new file mode 100644
index 00000000..02f4cab5
--- /dev/null
+++ b/demo/cookie.ur
@@ -0,0 +1,26 @@
+cookie c : {A : string, B : float, C : int}
+
+fun set r =
+ setCookie c {A = r.A, B = readError r.B, C = readError r.C};
+ return <xml>Cookie set.</xml>
+
+fun main () =
+ ro <- getCookie c;
+ let
+ val xml = case ro of
+ None => <xml>No cookie set.</xml>
+ | Some v => <xml>Cookie: A = {[v.A]}, B = {[v.B]}, C = {[v.C]}</xml>
+ in
+ return <xml><body>
+ {xml}<br/><br/>
+
+ <form>
+ A: <textbox{#A}/><br/>
+ B: <textbox{#B}/><br/>
+ C: <textbox{#C}/><br/>
+ <submit action={set}/>
+ </form>
+ </body></xml>
+ end
+
+