view demo/more/conferenceFields.ur @ 1020:dfe34fad749d

RPC uses VM support for call/cc
author Adam Chlipala <adamc@hcoop.net>
date Sun, 25 Oct 2009 14:07:10 -0400
parents 16f7cb0891b6
children 53a22f46f377
line wrap: on
line source
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 = _}