]> git.decadent.org.uk Git - maypole.git/blob - templates/factory/addnew
f530bc99383105fa608e453fe43375ae4c6af986
[maypole.git] / templates / factory / addnew
1 [%#
2
3 =head1 addnew
4
5 This is the interface to adding a new instance of an object. (or a new
6 row in the database, if you want to look at it that way) It displays a
7 form containing a list of HTML components for each of the columns in the
8 table.
9
10 =cut
11
12 #%]
13
14 <div id="addnew">
15 <form method="post" action="[% base %]/[% classmetadata.table %]/do_edit/">
16     <fieldset>
17 <legend>Add a new [% classmetadata.moniker %]</legend>
18     [% FOR col = classmetadata.columns %]
19         [% NEXT IF col == "id" %]
20             <label><span class="field">[% classmetadata.colnames.$col %]</span>
21             [% 
22             SET elem = classmetadata.cgi.$col.clone;
23             IF elem.tag == "textarea";
24                 elem = elem.push_content(request.param(col));
25             ELSE;
26                 elem.attr("value", request.param(col));
27             END;
28             elem.as_XML; %]
29             </label>
30         [% IF errors.$col %]
31            <span class="error">[% errors.$col %]</span>
32         [% END %]
33
34     [% END; %]
35     <input type="submit" name="create" value="create"/>
36 </fieldset>
37 </form>
38 </div>