comparison demo/prose @ 780:0084af7af35a

subforms demo
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 May 2009 15:53:29 -0400
parents 7394368a5cad
children c884a42599f3
comparison
equal deleted inserted replaced
779:7394368a5cad 780:0084af7af35a
77 upload.urp 77 upload.urp
78 78
79 <p>HTTP file upload is made convenient, via the abstract types <tt>blob</tt> and <tt>file</tt> in the standard library. A <tt>blob</tt> is a binary sequence, and a <tt>file</tt> combines a <tt>blob</tt> with MIME type information. An <tt>upload</tt> form input can be used to accept <tt>file</tt>s from the user.</p> 79 <p>HTTP file upload is made convenient, via the abstract types <tt>blob</tt> and <tt>file</tt> in the standard library. A <tt>blob</tt> is a binary sequence, and a <tt>file</tt> combines a <tt>blob</tt> with MIME type information. An <tt>upload</tt> form input can be used to accept <tt>file</tt>s from the user.</p>
80 80
81 <p>In the <tt>.urp</tt> file for this example, we give a whitelist of MIME types to be accepted. The application will echo back to the user any file he uploads as one of those types. You can try submitting other kinds of files to verify that they are rejected.</p> 81 <p>In the <tt>.urp</tt> file for this example, we give a whitelist of MIME types to be accepted. The application will echo back to the user any file he uploads as one of those types. You can try submitting other kinds of files to verify that they are rejected.</p>
82
83 subforms.urp
84
85 <p>In the examples so far, the number of inputs per form has been constant. Often it is useful to have a varying set of form inputs. Ur/Web provides the <tt>&lt;subforms&gt;</tt> and <tt>&lt;entry&gt;</tt> tags for grouping a list of forms with the same field names and types into a single, list-valued composite form. This demo shows those tags in action, in a simple form echoing application that lets the user add and remove inputs.</p>
82 86
83 listShop.urp 87 listShop.urp
84 88
85 <p>This example shows off algebraic datatypes, parametric polymorphism, and functors.</p> 89 <p>This example shows off algebraic datatypes, parametric polymorphism, and functors.</p>
86 90