Mercurial > urweb
changeset 155:4334bb734187
Password inputs
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 24 Jul 2008 11:32:01 -0400 |
parents | e2b185379592 |
children | 34ccd7d2bea8 |
files | lib/basis.lig src/monoize.sml tests/pass.lac |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/basis.lig Thu Jul 24 11:16:54 2008 -0400 +++ b/lib/basis.lig Thu Jul 24 11:32:01 2008 -0400 @@ -66,6 +66,7 @@ -> nm :: Name -> unit -> tag attrs ([LForm] ++ ctx) inner [] [nm = ty] val textbox : lformTag string [] [] +val password : lformTag string [] [] val ltextarea : lformTag string [] [] con radio = [Body, Radio]
--- a/src/monoize.sml Thu Jul 24 11:16:54 2008 -0400 +++ b/src/monoize.sml Thu Jul 24 11:32:01 2008 -0400 @@ -259,7 +259,7 @@ fun input typ = case targs of - [(L.CName name, _)] => + [_, (L.CName name, _)] => (L'.EStrcat (tagStart "input", (L'.EPrim (Prim.String (" type=\"" ^ typ ^ "\" name=\"" ^ name ^ "\"/>")), loc)), loc) @@ -304,6 +304,7 @@ loc)), loc) | _ => (Print.prefaces "Targs" (map (fn t => ("T", CorePrint.p_con env t)) targs); raise Fail "No name passed to textarea tag")) + | "password" => input "password" | "ltextarea" => (case targs of [_, (L.CName name, _)] =>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/pass.lac Thu Jul 24 11:32:01 2008 -0400 @@ -0,0 +1,13 @@ +val handler = fn r => <html><body> + <li> Name: {cdata r.Nam}</li> + <li> Password: {cdata r.Word}</li> +</body></html> + +val main : unit -> page = fn () => <html><body> + <lform> + Name: <textbox{#Nam} /><br/> + Password: <password{#Word} /><br/> + + <submit action={handler}/> + </lform> +</body></html>