annotate demo/subforms.ur @ 789:d18f6f0bcf60

Describe GET/POST
author Adam Chlipala <adamc@hcoop.net>
date Tue, 05 May 2009 14:45:21 -0400
parents 0084af7af35a
children be0c4e2e488a
rev   line source
adamc@780 1 fun sub r =
adamc@780 2 let
adamc@780 3 fun sub' ls =
adamc@780 4 case ls of
adamc@780 5 [] => <xml/>
adamc@780 6 | r :: ls => <xml>
adamc@780 7 <li>{[r.Num]} = {[r.Text]}</li>
adamc@780 8 {sub' ls}
adamc@780 9 </xml>
adamc@780 10 in
adamc@780 11 return <xml><body>
adamc@780 12 {sub' r.Lines}
adamc@780 13 </body></xml>
adamc@780 14 end
adamc@780 15
adamc@780 16 fun subforms n =
adamc@780 17 if n <= 0 then
adamc@780 18 <xml/>
adamc@780 19 else
adamc@780 20 <xml>
adamc@780 21 <entry>
adamc@780 22 <hidden{#Num} value={show n}/>
adamc@780 23 <li>{[n]}: <textbox{#Text}/></li>
adamc@780 24 </entry>
adamc@780 25 {subforms (n - 1)}
adamc@780 26 </xml>
adamc@780 27
adamc@780 28 fun form n = return <xml><body>
adamc@780 29 <form>
adamc@780 30 <subforms{#Lines}>
adamc@780 31 {subforms n}
adamc@780 32 </subforms>
adamc@780 33 <submit action={sub}/>
adamc@780 34 </form>
adamc@780 35
adamc@780 36 <a link={form (n + 1)}>One more blank</a><br/>
adamc@780 37 {if n > 0 then
adamc@780 38 <xml><a link={form (n - 1)}>One fewer blank</a></xml>
adamc@780 39 else
adamc@780 40 <xml/>}
adamc@780 41 </body></xml>
adamc@780 42
adamc@780 43 fun main () = form 1