5 This is the edit page. It edits the passed-in object, by displaying a
6 form similar to L<addnew> but with the current values filled in.
15 [% IF request.action == 'edit' %]
20 <div id="title">Edit a [% classmetadata.moniker %]</div>
21 <form action="[% base %]/[% item.table %]/do_edit/[% item.id %]" method="post">
23 <legend>Edit [% object.name %]</legend>
24 [% FOR col = classmetadata.columns;
25 NEXT IF col == "id" OR col == classmetadata.table _ "_id";
26 '<label><span class="field">';
27 classmetadata.colnames.$col || col | ucfirst | replace('_',' '); ":</span>";
28 object.to_field(col).as_XML;
31 '<span class="error">'; errors.$col;'</span>';
34 <input type="submit" name="edit" value="edit"/>
35 <input type="hidden" name="__form_id" value="[% request.make_random_id %]">
41 <form method="post" action="[% base %]/[% classmetadata.table %]/do_edit/">
43 <legend>Add a new [% classmetadata.moniker %]</legend>
44 [% FOR col = classmetadata.columns %]
45 [% NEXT IF col == "id" %]
46 <label><span class="field">[% classmetadata.colnames.$col %]</span>
48 SET elem = classmetadata.cgi.$col.clone;
49 IF request.action == 'do_edit';
50 IF elem.tag == "textarea";
51 elem = elem.push_content(request.param(col));
53 elem.attr("value", request.param(col));
59 <span class="error">[% errors.$col | html %]</span>
63 <input type="submit" name="create" value="create" />
64 <input type="hidden" name="__form_id" value="[% request.make_random_id %]" />