annotate demo/crud3.ur @ 785:fe63a08cbb91

Table constraint Ur code
author Adam Chlipala <adamc@hcoop.net>
date Tue, 05 May 2009 12:49:16 -0400
parents c884a42599f3
children 669ac5e9a69e
rev   line source
adamc@781 1 table t : {Id : int, Text : string}
adamc@781 2 PRIMARY KEY Id
adamc@781 3
adamc@781 4 open Crud.Make(struct
adamc@781 5 val tab = t
adamc@781 6
adamc@781 7 val title = "Crud3"
adamc@781 8
adamc@781 9 val cols = {Text = {Nam = "Text",
adamc@781 10 Show = txt,
adamc@781 11 Widget = (fn (nm :: Name) => <xml>
adamc@781 12 <subform{nm}>
adamc@781 13 <textbox{#A}/>
adamc@781 14 <textbox{#B}/>
adamc@781 15 </subform>
adamc@781 16 </xml>),
adamc@781 17 WidgetPopulated = (fn (nm :: Name) s => <xml>
adamc@781 18 <subform{nm}>
adamc@781 19 <textbox{#A} value={s}/>
adamc@781 20 <textbox{#B}/>
adamc@781 21 </subform>
adamc@781 22 </xml>),
adamc@781 23 Parse = (fn p => p.A ^ p.B),
adamc@781 24 Inject = _
adamc@781 25 }
adamc@781 26 }
adamc@781 27 end)