diff demo/cookie.ur @ 464:91914c15a85b

Cookie demo code; fix error message display
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 12:22:50 -0500
parents
children ddd363e856ff
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/cookie.ur	Thu Nov 06 12:22:50 2008 -0500
@@ -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
+
+