summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-14 09:33:48 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-14 09:33:48 -0400
commitb6163966d74b8f4636d63f28179205ed9f6daaaf (patch)
treea2cae7eab132b9d3a0e2a1761daa414b869cdf3e /lib
parent9e6bd5dd1394c99f0a9b29369a4957c958e0830c (diff)
cselect
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js10
-rw-r--r--lib/ur/basis.urs12
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index a29914b9..5482c2a5 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -281,7 +281,7 @@ function dyn(s) {
populate(x);
}
-function inp(t, s) {
+function inp(t, s, content) {
var x = document.createElement(t);
x.dead = false;
x.signal = ss(s);
@@ -289,7 +289,13 @@ function inp(t, s) {
x.recreate = function(v) { if (x.value != v) x.value = v; };
populate(x);
addNode(x);
- x.onkeyup = function() { sv(s, x.value) };
+ if (t == "select") {
+ x.onchange = function() { sv(s, x.value) };
+ x.innerHTML = content;
+ sv(s, x.value);
+ } else
+ x.onkeyup = function() { sv(s, x.value) };
+
return x;
}
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 9736ce1e..cc18d7b2 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -623,13 +623,17 @@ val submit : ctx ::: {Unit} -> use ::: {Type}
(*** AJAX-oriented widgets *)
-con cformTag = fn (attrs :: {Type}) =>
+con cformTag = fn (attrs :: {Type}) (inner :: {Unit}) =>
ctx ::: {Unit}
-> [[Body] ~ ctx] =>
- unit -> tag attrs ([Body] ++ ctx) [] [] []
+ unit -> tag attrs ([Body] ++ ctx) inner [] []
-val ctextbox : cformTag [Value = string, Size = int, Source = source string]
-val button : cformTag [Value = string, Onclick = transaction unit]
+val ctextbox : cformTag [Value = string, Size = int, Source = source string] []
+val button : cformTag [Value = string, Onclick = transaction unit] []
+
+con cselect = [Cselect]
+val cselect : cformTag [Source = source string] cselect
+val coption : unit -> tag [Value = string, Selected = bool] cselect [] [] []
(*** Tables *)