summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-24 11:32:01 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-24 11:32:01 -0400
commit84f7c995c0ad553d3fc91d1b31f320fc9de58d79 (patch)
treeb5b01d65e0f190463fac9857ecf3eb04f7892a59
parent5f895c17f35466d10ef80cd7146638d8505e4e9b (diff)
Password inputs
-rw-r--r--lib/basis.lig1
-rw-r--r--src/monoize.sml3
-rw-r--r--tests/pass.lac13
3 files changed, 16 insertions, 1 deletions
diff --git a/lib/basis.lig b/lib/basis.lig
index 913e6af4..94977faf 100644
--- a/lib/basis.lig
+++ b/lib/basis.lig
@@ -66,6 +66,7 @@ con lformTag = fn ty :: Type => fn inner :: {Unit} => fn attrs :: {Type} =>
-> 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]
diff --git a/src/monoize.sml b/src/monoize.sml
index c193e611..1dcef40a 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -259,7 +259,7 @@ fun monoExp (env, st) (all as (e, loc)) =
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 @@ fun monoExp (env, st) (all as (e, loc)) =
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, _)] =>
diff --git a/tests/pass.lac b/tests/pass.lac
new file mode 100644
index 00000000..2260267a
--- /dev/null
+++ b/tests/pass.lac
@@ -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>