On Wed, Nov 08, 2006 at 12:13:53PM -0800, Bill Moseley wrote: > Well, in my case currently this is all I'd need to do: > > [% # Template to generate a standard form > > WRAPPER form_wrapper; > FOR f = form.fields; > field(form, f ); > END; > END; > > %]
Hi Bill,
Which module are you using to get this syntax?
I've started using HTML::Widget, building the edit boxes within the
controller, and then formatting them in the template:
[%- SET count = 0 -%]
<table id="matrix">
[%- FOREACH column IN fields; -%]
[% "<tr";
' class="alternate"' IF count % 2;
">" %]
<th> [% headings.$count %] </th>
<td>
[% edit = widget.get_element('name', column) %]
[% IF edit %]
[% foo=edit.value(record.$column);
edit.field_xml;
widget.result.element(column) %]
[% ELSE %]
[% perhaps_link(record, fieldtable, column) %]
[% END %]
</td>
</tr>
[%- SET count = count + 1 -%]
[% END %]
</table>
The real mess comes though with views which contain data from other
tables, i.e. $record->owner->username for instance, which in the
template would look like record.owner.username. This is a bit of pain
actually, because there is no such column as "owner.username", i.e. I
can't do
[% field = "owner.username"; record.field %]
This means I have to be very careful with column names, both in
the record, and in the widget.
It's not as clean as I'd like :/.
Joe
--
Josef Karthauser ([EMAIL PROTECTED]) http://www.josef-k.net/
Physics Particle Theory (student) http://www.pact.cpes.sussex.ac.uk/
================ An eclectic mix of fact and theory. =================
pgpEBeSzqmY1k.pgp
Description: PGP signature
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
