CGI-FormMagick

 view release on metacpan or  search on metacpan

lib/CGI/FormMagick/FAQ.pod  view on Meta::CPAN

Simply create a routine in your CGI script which accepts the data to
validate as an argument.  Have it return "OK" on success or a detailed
error message on failure.

    sub my_validation {
        my $data = shift;
        if ($data =~ /$some_pattern/) {
            return "OK";
        } else {
            return "That looks wrong to me.";
        }
    }

=head2 How do I add translations into another language?

Use the C<lexicon> element in your XML.

=head2 How do I do extra processing when a user clicks "Next"?

Use a C<post-event> on the C<page> element.  Create a subroutine that does
what you want:

    sub process_credit_card {
        my $cgi = shift;
	my $cardnum = $cgi->param("cardnum");
	my $response = do_processing($cardnum);
	print "<p>$response</p>";
    }

=head2 How do I choose which page to go to based on user input?

Use a C<page post-event> and set the value of the "wherenext" CGI
parameter:

    sub my_post_page_event {
        my $cgi = shift;
	if ($cgi->param("foo") eq "bar") {
            $cgi->param(-name => "wherenext", -value => "GoToThisPageName")
        } elsif ($cgi->param("had_enough") eq "Yes") {
            $cgi->param(-name => "wherenext", -value => "Finish")
        }
    }

=head1 TROUBLESHOOTING

=head2 General troubleshooting tips

Try turning on debugging:
    
    $f->debug(1);

This will print out general debugging messages to the web page.

=head2 Why isn't my data preserved from one page to the next?

You probably need to make your C<session-tokens> directory writable and
executable by the web server.  Either:

    chown www session-tokens 
       (assuming your webserver runs as the www user)
    chmod 700 session-tokens

Or...

    chmod 777 session-tokens

Note that the latter allows anyone on the system to write to this
directory, and is a greater security risk than the former method.



( run in 1.415 second using v1.01-cache-2.11-cpan-39bf76dae61 )