A little formating goes a long way for clarity here:

my %options = ( show_reqs => checkbox( -name => 'show_reqids', -checked => 0, -value => 'ON', -label => 'Show requirement + IDs?'), date => "<b>Created: </b>" . radio_group( -name=>'bef_since', -values=>['before', 'since'], -default=>'none', -labels => {'before' => 'b +efore ', 'since' => 's +ince (inclusive)'} ) . "&nbsp;&nbsp;<b>Date</b> (YYYY-MM-DD +): " . textfield(-name=>'date', -size=>10, +-maxlength=>10), req_type => "<b>Requirement Type</b> (e.g. BRQ): " . textfield( -name => 'reqtype', -size => 5, -maxlength=>5), ); my %report_types = ( 0 => { name => "Project Requirements: Filtered by +Creation Date", opts => ['show_reqs', 'date'], coderef => \&report_type_two }, 1 => { name => "Project Requirement Revisions: Fil +tered by Creation Date, Type, and Version Reason", opts => ['show_reqs', 'req_type', 'date'], coderef => \&report_type_three}, );

It is now more obvious that you are generating the actual elements a little soon. I would make the options sub refs that take the report name as an argument (and possibly more) so that you could create unique instances. At least they should take the fields own name as an argument. I think the following will be close:

my %options = ( show_reqs => sub { my $report = shift; return checkbox( -name => $report . '_show_ +reqids', -checked => 0, -value => 'ON', -label => 'Show requirement + IDs?'), } ); print $options{$option}->($report), "\n";

In this manner your options are constructors. They could even take in more arguments, like default values or something, so that each report could have different defaults.


___________
Eric Hodges

In reply to Re^3: Is there a way to set a textfield -name value at runtime? by eric256
in thread Is there a way to set a textfield -name value at runtime? by memnoch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.