view tests/cookieSec.ur @ 2057:f4a6ccb7937f

Allow Body tags inside cformTags This is required by Bootstrap. For example, see http://getbootstrap.com/components/#alerts-dismissible
author Sergey Mironov <grrwlf@gmail.com>
date Sun, 17 Aug 2014 18:28:37 +0000
parents f2a2be93331c
children
line wrap: on
line source
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]}));
                   return <xml>Done</xml>

fun main () = return <xml><body>
  <form>
    <textbox{#Id}/> <submit value="Get cookie" action={setter}/>
  </form>

  <form>
    <submit value="Write to database" action={writer}/>
  </form>
</body></xml>