Hi all,

can anybody help?
I am trying to set up a form using a hash of hashes to build different 
types of fields as I think it is easier to check and process form input:

my %fields = (textfield => { 'Name_of_textfield' => { -name => 'bla' },
                                'Name_of_next_textfield' => {-name => 'blo'}
                                },
                 textarea => {'Name_of_textarea' => {-name => 'blu' }
                                },
                 scrolling_list => {Name_of_list' => {-name => 'ble',
                                                       -values => ['1', 
'2', '3'],
                                                           -default => ['1']
                                                        }
                                               }
);
This hash of hashes is passed to a subroutine to display the from when the 
script is called on for the first time. The idea was to use the keys of the 
hash as tags for the html document.

sub form
{
my $field_ref = shift;
print start_form (-action => url());
foreach my $tag (keys (%{$field_ref})){
     my $name = (keys(%{$$field_ref{$tag}}));
     my $record = $$field_ref{$tag}{$name};
     my $label = $record->{label};
                       print ($tag (-name => $record->{name}));
                   }
print submit (-name => "choice", -value => "Send"),
     end_form();
}

It doesn't work I keep getting a "Can't use string ("scrolling_list") as 
symbol ref while "strict refs" in use at line number xy.
But it doesn't work either if I use "no strict 'refs'" in the subroutine. 
Then only the submit button is displayed.
I suppose it has something to do with hard vs symbolic references but to be 
honest I didn't get that part in the perldocs.
Is there a better way to solve the problem?

Thanks Marcus




Marcus Willemsen
tel: ++49(0)221 91 38 80 16
fax: ++49(0)221 91 38 80 18
www.juve.de
[EMAIL PROTECTED]
[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to