blob: ae9ed5a70a57fc67c87a76bd2614a6fdce047c79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
open Meta
val title = string "Title"
val abstract = textarea "Abstract"
fun charIn s =
if String.length s = 0 then
error <xml>Impossible: Empty option value</xml>
else
String.sub s 0
con dropdown = (char, string)
fun dropdown name opts = {Nam = name,
Show = txt,
Widget = fn [nm :: Name] => <xml><select{nm}>
{List.mapX (fn x => <xml><option>{[x]}</option></xml>) opts}
</select></xml>,
WidgetPopulated = fn [nm :: Name] v => <xml><select{nm}>
{List.mapX (fn x => <xml><option selected={x = v}>{[x]}</option></xml>) opts}
</select></xml>,
Parse = charIn,
Inject = _}
|