summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ur/basis.urs11
-rw-r--r--src/monoize.sml3
-rw-r--r--src/urweb.grm1
-rw-r--r--tests/html5_forms.ur8
4 files changed, 22 insertions, 1 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 2f523a20..7691cdce 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -956,12 +956,21 @@ val hidden : formTag string [] [Data = data_attr, Id = string, Value = string]
val textbox : formTag string [] ([Value = string, Size = int, Placeholder = string, Source = source string, Onchange = transaction unit,
Ontext = transaction unit] ++ boxAttrs ++ inputAttrs)
val password : formTag string [] ([Value = string, Size = int, Placeholder = string, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs)
-val email : formTag string [] ([Value = string, Size = int, Placeholder = string, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs)
val textarea : formTag string [] ([Rows = int, Cols = int, Onchange = transaction unit,
Ontext = transaction unit] ++ boxAttrs ++ inputAttrs)
val checkbox : formTag bool [] ([Checked = bool, Onchange = transaction unit] ++ boxAttrs)
+(* HTML5 widgets galore! *)
+
+type textWidget = formTag string [] ([Value = string, Size = int, Placeholder = string, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs)
+
+val email : textWidget
+val search : textWidget
+val url_ : textWidget
+val tel : textWidget
+
+
type file
val fileName : file -> option string
val fileMimeType : file -> string
diff --git a/src/monoize.sml b/src/monoize.sml
index cc5395f0..96323c9e 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -3664,6 +3664,9 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
raise Fail "No name passed to textbox tag"))
| "password" => input "password"
| "email" => input "email"
+ | "search" => input "search"
+ | "url_" => input "url"
+ | "tel" => input "tel"
| "textarea" =>
(case targs of
[_, (L.CName name, _)] =>
diff --git a/src/urweb.grm b/src/urweb.grm
index 240f64cb..85e5f092 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -221,6 +221,7 @@ val inDml = ref false
fun tagIn bt =
case bt of
"table" => "tabl"
+ | "url" => "url_"
| _ => bt
datatype prop_kind = Delete | Update
diff --git a/tests/html5_forms.ur b/tests/html5_forms.ur
index 435e4ada..a9bf7f77 100644
--- a/tests/html5_forms.ur
+++ b/tests/html5_forms.ur
@@ -2,6 +2,10 @@ fun handler r = return <xml><body>
A: {[r.A]}<br/>
B: {[r.B]}<br/>
C: {[r.C]}<br/>
+ D: {[r.D]}<br/>
+ E: {[r.E]}<br/>
+ F: {[r.F]}<br/>
+ G: {[r.G]}<br/>
</body></xml>
fun main () =
@@ -10,6 +14,10 @@ fun main () =
<textbox{#A} required placeholder="bobby"/>
<textbox{#B} placeholder="soggy" autofocus/>
<checkbox{#C}/>
+ <email{#D}/>
+ <url{#E}/>
+ <tel{#F}/>
+ <search{#G}/>
<submit action={handler}/>
</form>