i am using cgi.pm to pull the returned values for a web-based form
with the following code:
## grab form input
my $query = CGI->new();
## grab form field and stick values in hash
my @formfields = $query->param;
for my $field(@formfields) {
if ( $field eq 'recipient' ||
$field eq 'replyaddr' ||
$field eq 'required' ||
$field eq 'replyname' ||
$field eq 'title' ||
$field eq 'redirect' ||
$field eq 'subject' ||
$field eq 'postdir' ||
$field eq 'body_message' ||
$field eq 'return_link_title' ||
$field eq 'return_link_url' ) {
$CONFIG{$field} = $query->param($field);
} else {
$FORM{$field} = $query->param($field);
}
}
now, this seems to work fine and the values are stuffed into one of
two seperate hashes. now i look through the %form hash and verify that
all the form fields that i mark as required, are filled in
## each missed field is placed in a new array
for my $i(@required) {
chomp $i;
if (!$FORM{$i}) {
push @missed_fields, $i;
}
}
the @required array just simply a list of the form fields that
need to be present.
what is odd is that sometimes, even though all the form fields
have been filled in, the script pushes _all_ the form's fields
into @misssed_fields as though cgi.pm hasnt extract any values
for them. this seems to occur when a group of radio buttons are
selected. it occurs whether or not the radio button form names
are within the @required array or not. just having them selected
seems to cause cgi.pm to freak.
does this sound at all logical or as a known issue? i can barely
believe that it would since i would imagine that many sights
are using radio buttons! the form is not especially large, only
30 fields to fill in. your input is very appreciated on this one!
humbly -c
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.