in reply to altering existing form

In your template, you're going to need a loop. Change
<input type=text name="dept" size=30>
to this:
<select name='dept> <TMPL_LOOP DEPT_LOOP> <option><TMPL_VAR DEPT></option> </TMPL_LOOP> </select>
Then, in your script, add something like this:
my @loop_data; for my $dept (@dept) { push(@loop_data, {DEPT => $dept}); } $template->param(DEPT_LOOP => \@loop_data);
Where the @dept array is generated with your original code.

Replies are listed 'Best First'.
Re^2: altering existing form
by djbryson (Beadle) on Feb 27, 2007 at 16:22 UTC
    ok so, I already have
    $formTemplate = new HTML::Template( filename => $FORM_TMPL_FILE ); for my $key (keys %formparams) { $formTemplate->param($key => $formparams{"$key"}); } createForm($formTemplate);
    How do I incorporate
    my @loop_data; for my $dept (@dept) { push(@loop_data, {DEPT => $dept}); } $template->param(DEPT_LOOP => \@loop_data);
    Sorry, i'm new to TMPL_LOOP... i'm reading the docs...
    UPDATE
    I guess i need DEPT to be part of my %formparams
    DEPT =>@loop_data

    update2 I GOT IT! After
    my @loop_data; foreach my $dept (@dept) { push(@loop_data, {DEPT => $dept}); }
    I just need to add:
    DEPT_LOOP => \@loop_data,
    to %formparams
    I think i actually get it too, lol Thanks guys