I don't see anything blocking you from passing in the array (with one element if there is only one) and using a Template loop.
<label for="[% fields.0.id %]">[% fields.0.name %] = </label> <input name="[% fields.0.id %]" placeholder="[% fields.0.placeholder +%]" type="text" id="[% fields.0.id %]" [% fields.0.required %] pattern="[% fie +lds.0.regex %]" > [% FOREACH field IN fields %] [% NEXT IF loop.first %] <label> - </label> <input name="[% field.id %]" placeholder="[% field.placeholder %]" ty +pe="text" id="[% field.id %]" [% field.required %] pattern="[% field.reg +ex %]" > <label for="[% field.id %]">[% field.units %]</label> [% END %]
$fields = [{ id => 'loww1', placeholder => 400, ... }, { ... }];
Hope this helps!
In reply to Re^3: Form generation and validation
by 1nickt
in thread Form generation and validation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |