# $invitestable is a pointer to a array of hashes. # This 'table' contains prepopulated rows of information. # Keys in these hashes are the same as the elements in # @fieldorder below. Uh, oh yea, there is a key called # 'id' as well, very important. $q = new CGI; $fielddefs = &defineformfields; @fieldorder = ('sendemail','firstname', 'lastname', 'companyname', 'email', 'projectname', 'clientid'); my (@rows); foreach my $row (@$invitestable) { foreach my $element (@fieldorder) { my $function = $fielddefs->{$element}->{function}; $fielddefs->{$element}->{name} = $element . '.' . $row->{id}; $row->{html}->{$element} = $q->$function($fielddefs->{$element}); } } sub defineformfields { my %fielddefs = ( sendemail=>{ order=>1, function=>'checkbox_group', values=>['on'], nolabels=>1, defaults=>['on'], title=>'Send' }, email=>{ order=>3, function=>'textfield', size=>11, title=>'Email' }, date=>{ order=>2, function=>'textfield', size=>12, title=>'Date' }, fullname=>{ order=>2, function=>'textfield', size=>8, title=>'Name' }, firstname=>{ order=>2, function=>'textfield', size=>8, title=>'First Name' }, lastname=>{ order=>2, function=>'textfield', size=>9, title=>'Last Name' }, companyname=>{ order=>4, function=>'textfield', size=>12, title=>'Company Name' }, projectname=>{ order=>4, function=>'textfield', size=>10, title=>'Project Name' }, clientid=>{ function=>'hidden' } ); return (\%fielddefs); }