in reply to Re^2: Form generation and validation
in thread Form generation and validation
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Form generation and validation
by Anonymous Monk on Aug 01, 2019 at 11:21 UTC |