summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ur/basis.urs2
-rw-r--r--src/cjr_print.sml12
-rw-r--r--tests/radio.ur26
-rw-r--r--tests/radio.urs1
4 files changed, 27 insertions, 14 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 67e6abc6..189bef0e 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -830,7 +830,7 @@ val postType : postBody -> string
val postData : postBody -> string
con radio = [Body, Radio]
-val radio : formTag string radio [Id = id]
+val radio : formTag (option string) radio [Id = id]
val radioOption : unit -> tag ([Value = string, Checked = bool] ++ boxAttrs) radio [] [] []
con select = [Select]
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 29b0f5d2..d11b8f30 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008-2011, Adam Chlipala
+(* Copyright (c) 2008-2012, Adam Chlipala
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -2868,6 +2868,16 @@ fun p_file env (ds, ps) =
string "}}",
newline]
end
+ | TOption _ =>
+ box [string "uw_input_",
+ p_ident x,
+ space,
+ string "=",
+ space,
+ string "uw_get_input(ctx, ",
+ string (Int.toString n),
+ string ");",
+ newline]
| _ =>
box [string "request = uw_get_",
string f,
diff --git a/tests/radio.ur b/tests/radio.ur
index e40872f8..e44eb0b7 100644
--- a/tests/radio.ur
+++ b/tests/radio.ur
@@ -1,13 +1,15 @@
-val handler = fn x => <html><body>
- You entered: {cdata x.A}
-</body></html>
+fun handler x = return <xml><body>
+ You entered: {[case x.A of
+ None => "nothing at all"
+ | Some v => v]}
+</body></xml>
-val main = fn () => <html><body>
- <lform>
- <radio{#A}>
- <li> <radioOption value="A"/>A</li>
- <li> <radioOption value="B"/>B</li>
- </radio>
- <submit action={handler}/>
- </lform>
-</body></html>
+fun main () = return <xml><body>
+ <form>
+ <radio{#A}>
+ <li><radioOption value="A"/>A</li>
+ <li><radioOption value="B"/>B</li>
+ </radio>
+ <submit action={handler}/>
+ </form>
+</body></xml>
diff --git a/tests/radio.urs b/tests/radio.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/radio.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page