I tried to write something like the following:

 datatype s = A | B | C

 fun main () =
     s <- source A;
     return <xml><body><form>
       <radio{#Test}>
         <radioOption value="A" onclick={fn _ => set s A} />
         <radioOption value="B" onclick={fn _ => set s B} />
         <radioOption value="C" onclick={fn _ => set s C} />
       </radio>
       <dyn signal={v <- signal s;
                    return <xml><div>{[case v of A => "A"
                                               | B => "B"
                                               | C => "C"]}</div></xml>} />
     </form></body></xml>

Because the onclick event handler produced is hard-coded to return
false, the radio buttons don't update correctly.

I have applied the attached patch to my own installation to get around
it, but I imagine this might break existing code.  It seems like one
would want more explicit control of the return value of the event
handler.

# HG changeset patch
# User Julian Squires <[email protected]>
# Date 1431006637 14400
#      Thu May 07 09:50:37 2015 -0400
# Node ID cbf5051082f8b2f43bc17aaf0469150a3c8ea101
# Parent  dbaae182b91fda903f6e45b1016b7e537da26d0b
Do not explicitly return false from onclick handler

diff -r dbaae182b91f -r cbf5051082f8 src/monoize.sml
--- a/src/monoize.sml	Wed May 06 09:12:32 2015 -0400
+++ b/src/monoize.sml	Thu May 07 09:50:37 2015 -0400
@@ -3402,7 +3402,7 @@
                                                                        strH s',
                                                                        (L'.EStrcat (
                                                                         (L'.EJavaScript (L'.Attribute, e), loc),
-                                                                        strH ");return false'"), loc)),
+                                                                        strH ");'"), loc)),
                                                                        loc)), loc),
                                                          fm)
                                                     end
--
Julian Squires
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to