Hello:

I have a form entirely design with perl and it has many radio button. What I trying to do is to make some fields required and if one is missed, then the a subroutine is called and it will display the list of the missed fields. Here is the sub:

sub process_form
{
my ($one,$two,$three,$four,$five,$six,$seven,$eight,$nine,$ten,$eleven,$twelve,$thirteen,$fourteen,$fifteen,
$sixteen,$seventeen,$eighteen,$nineteen,$twenty,$twentyone,$twentytwo) =
(param("one"),param("two"),param("three"),param("four"),param("five"),param("six"),param("seven"),param("eight"),
param("nine"),param("ten"),param("eleven"),param("twelve"),param("thirteen"),param("fourteen"),param("fifteen"),param("sixteen"),
param("seventeen"),param("eighteen"),param("nineteen"),param("twenty"),param("twentyone"),param("twentytwo"));


@required_fields = ("one","two","three", "four","five","seven","eight","nine","eleven", "twelve","fourteen",
"sixteen","seventeen","nineteen"); #these are the required fields


#here is another set of required fields depending upon some conditions
push(@required_fields, "six") if $five eq "Yes";
push(@required_fields, "ten") if $nine eq "No";
push(@required_fields, "thirteen") if $twelve eq "Difficult";
push(@required_fields, "fifteen") if $fourteen eq "Yes";
push(@required_fields, "eighteen") if $seventeen eq "Fair" || $seventeen eq "Poor";
push(@required_fields, "twenty") if $nineteen eq "Less frequently"|| $nineteen eq "Discontinue";


@errors = ();
   foreach my $i(@required_fields)

   {
          push(@errors, $i);
   }

if([EMAIL PROTECTED])

{

print("Thank you for your time.");

}

else

       {
           print("Fill out the required fields number:");
           foreach my $error(@errors)
           {

print(li( $error ));

}
survey_form();
}


}

Apparently, the ckecking is not performed. I purposely left all the field unchecked and it display the array @errors list. And when I checked some radio button, it display the same list. It seems that I am missing something here. Could someone tell me what it is and if there is a better way of doing this.

Thanks.



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



Reply via email to