Mercurial > urweb
annotate demo/cookie.ur @ 529:4df69124e9c5
Shorthands
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 27 Nov 2008 16:55:30 -0500 |
parents | ddd363e856ff |
children | 93315ac00394 |
rev | line source |
---|---|
adamc@464 | 1 cookie c : {A : string, B : float, C : int} |
adamc@464 | 2 |
adamc@464 | 3 fun set r = |
adamc@464 | 4 setCookie c {A = r.A, B = readError r.B, C = readError r.C}; |
adamc@464 | 5 return <xml>Cookie set.</xml> |
adamc@464 | 6 |
adamc@464 | 7 fun main () = |
adamc@464 | 8 ro <- getCookie c; |
adamc@465 | 9 return <xml><body> |
adamc@465 | 10 {case ro of |
adamc@465 | 11 None => <xml>No cookie set.</xml> |
adamc@465 | 12 | Some v => <xml>Cookie: A = {[v.A]}, B = {[v.B]}, C = {[v.C]}</xml>} |
adamc@465 | 13 <br/><br/> |
adamc@464 | 14 |
adamc@465 | 15 <form> |
adamc@465 | 16 A: <textbox{#A}/><br/> |
adamc@465 | 17 B: <textbox{#B}/><br/> |
adamc@465 | 18 C: <textbox{#C}/><br/> |
adamc@465 | 19 <submit action={set}/> |
adamc@465 | 20 </form> |
adamc@465 | 21 </body></xml> |