annotate demo/more/conferenceFields.ur @ 1013:d9483301ff0e

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