[% FOREACH row = rows %]
<tr>
<td style="text-align: left; vertical-align: top;" align="right">
[% rqty = row _ 'qty' %][% form.field.$rqty.field %] </td>
<td> [% rcod = row _ 'cod' %][% form.field.$rcod.field %] </td>
<td> [% rdes = row _ 'des' %][% form.field.$rdes.field %] </td>
<td style="vertical-align: top;"> [% rprice = row _ 'price' %][% form.field.$rprice.field %] </td>
</tr>
[% END %]
while in the code:
# $m is a ref to an array of arrays of 4 elements (my cart)
my $ft = $form->template(); # takes the current hashref of template
foreach my $el (@{$m}) # each $el contains a ref to the 4 fields of each row
{
push (@id, 'fld'.$i); # the array needed for TT to recall the elements
$form->field(name => 'fld'.$i.'qty', value=>$$el[0]);
$form->field(name => 'fld'.$i.'cod', value=>$$el[1]);
$form->field(name => 'fld'.$i.'des', value=>$$el[2]);
$form->field(name => 'fld'.$i.'price', value=>$$el[3]);
$i++;
}
$ft->{'data'}->{'rows'} = \@id; # I pass to TT the array
This creates a grid of elements, each with its own unique name.
This module and TT together are really great and powerful.
Thank you so much for this wonderful work!!!!!!!!!!!