summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/basis.lig4
-rw-r--r--src/lacweb.grm2
-rw-r--r--tests/form.lac9
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/basis.lig b/lib/basis.lig
index 264427a0..3e3950cf 100644
--- a/lib/basis.lig
+++ b/lib/basis.lig
@@ -63,3 +63,7 @@ con lformTag = fn ty :: Type => fn attrs :: {Type} =>
-> nm :: Name -> unit
-> tag attrs ([LForm] ++ ctx) [] [] [nm = ty]
val textbox : lformTag string []
+
+val submit : ctx ::: {Unit} -> [LForm] ~ ctx
+ -> use ::: {Type} -> unit
+ -> tag [Action = $use -> page] ([LForm] ++ ctx) ([LForm] ++ ctx) use []
diff --git a/src/lacweb.grm b/src/lacweb.grm
index 0d2ab714..4fd3dc8e 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -285,7 +285,6 @@ eexp : eapps (eapps)
end)
| LPAREN eexp RPAREN DCOLON cexp (EAnnot (eexp, cexp), s (LPARENleft, cexpright))
- | eterm DOT ident (EField (eterm, ident), s (etermleft, identright))
eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
@@ -297,6 +296,7 @@ eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
| FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright))
| STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
+ | path DOT ident (EField ((EVar path, s (pathleft, pathright)), ident), s (pathleft, identright))
| FOLD (EFold, s (FOLDleft, FOLDright))
| XML_BEGIN xml XML_END (xml)
diff --git a/tests/form.lac b/tests/form.lac
index 790dea2a..a046928a 100644
--- a/tests/form.lac
+++ b/tests/form.lac
@@ -1,6 +1,13 @@
+val handler = fn r => <html><body>
+ <li> Name: {cdata r.Nam}</li>
+ <li> Word: {cdata r.Word}</li>
+</body></html>
+
val main : unit -> page = fn () => <html><body>
<lform>
Name: <textbox{#Nam} /><br/>
- Color: <textbox{#Color} /><br/>
+ Word: <textbox{#Word} /><br/>
+
+ <submit action={handler}/>
</lform>
</body></html>