summaryrefslogtreecommitdiff
path: root/demo/cookie.ur
blob: 02f4cab52db5c529dd0b2c968dffada748ea3999 (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
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