comparison demo/more/conferenceFields.ur @ 1011:16f7cb0891b6

Initial support for char in SQL
author Adam Chlipala <adamc@hcoop.net>
date Thu, 22 Oct 2009 16:15:56 -0400
parents 59097824f19b
children 53a22f46f377
comparison
equal deleted inserted replaced
1010:6b0f3853cc81 1011:16f7cb0891b6
1 open Meta 1 open Meta
2 2
3 val title = string "Title" 3 val title = string "Title"
4 val abstract = textarea "Abstract" 4 val abstract = textarea "Abstract"
5
6 fun charIn s =
7 if String.length s = 0 then
8 error <xml>Impossible: Empty option value</xml>
9 else
10 String.sub s 0
11
12 con dropdown = (char, string)
13 fun dropdown name opts = {Nam = name,
14 Show = txt,
15 Widget = fn [nm :: Name] => <xml><select{nm}>
16 {List.mapX (fn x => <xml><option>{[x]}</option></xml>) opts}
17 </select></xml>,
18 WidgetPopulated = fn [nm :: Name] v => <xml><select{nm}>
19 {List.mapX (fn x => <xml><option selected={x = v}>{[x]}</option></xml>) opts}
20 </select></xml>,
21 Parse = charIn,
22 Inject = _}
23