changeset 799:9330ba3a2799

cselect.onchange
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 May 2009 11:04:56 -0400
parents 83875a9eb9b8
children e92cfac1608f
files lib/ur/basis.urs src/elaborate.sml src/scriptcheck.sml tests/cselect.ur
diffstat 4 files changed, 29 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/basis.urs	Thu May 14 10:31:11 2009 -0400
+++ b/lib/ur/basis.urs	Thu May 14 11:04:56 2009 -0400
@@ -632,7 +632,8 @@
 val button : cformTag [Value = string, Onclick = transaction unit] []
 
 con cselect = [Cselect]
-val cselect : cformTag [Source = source string] cselect
+val cselect : cformTag [Source = source string,
+                        Onchange = transaction unit] cselect
 val coption : unit -> tag [Value = string, Selected = bool] cselect [] [] []
 
 (*** Tables *)
--- a/src/elaborate.sml	Thu May 14 10:31:11 2009 -0400
+++ b/src/elaborate.sml	Thu May 14 11:04:56 2009 -0400
@@ -3831,6 +3831,8 @@
         else
             app (fn f => f ()) (!checks);
 
+        (*preface ("file", p_file env' file);*)
+
         (L'.DFfiStr ("Basis", basis_n, sgn), ErrorMsg.dummySpan)
         :: ds
         @ (L'.DStr ("Top", top_n, topSgn, topStr), ErrorMsg.dummySpan)
--- a/src/scriptcheck.sml	Thu May 14 10:31:11 2009 -0400
+++ b/src/scriptcheck.sml	Thu May 14 11:04:56 2009 -0400
@@ -43,9 +43,31 @@
 val pushBasis = SS.addList (SS.empty,
                             ["new_channel",
                              "self"])
+
+val events = ["abort",
+              "blur",
+              "change",
+              "click",
+              "dblclick",
+              "error",
+              "focus",
+              "keydown",
+              "keypress",
+              "keyup",
+              "load",
+              "mousedown",
+              "mousemove",
+              "mouseout",
+              "mouseover",
+              "mouseup",
+              "reset",
+              "resize",
+              "select",
+              "submit",
+              "unload"]
                 
-val scriptWords = ["<script",
-                   " onclick='"]
+val scriptWords = "<script"
+                   :: map (fn s => "on" ^ s ^ " ='") events
 
 val pushWords = ["rv("]
 
--- a/tests/cselect.ur	Thu May 14 10:31:11 2009 -0400
+++ b/tests/cselect.ur	Thu May 14 11:04:56 2009 -0400
@@ -1,7 +1,7 @@
 fun main () =
     s <- source "";
     return <xml><body>
-      <cselect source={s}>
+      <cselect source={s} onchange={v <- get s; alert ("Now it's " ^ v)}>
         <coption>Wilbur</coption>
         <coption>Walbur</coption>
       </cselect>