I'm having some /more than likely logical/ problems with building and returning forms using
CGI::Application::ValidateRM. This is a fairly new module to access
Data::FormValidator using
CGI::Application's interface.
The module looks good, and it looks like it will hoenstly work, but I've just got problems passing paramters around through CGI. So don't worry about the choice of module, but concentrate on how I'm /not/ passing arguments between subs.
_form_register_profile should pick up $q->param{email} from the form, but doesn't for some reason. Well the reason being that I haven't passed it, I'm sure -- but I need help on how to do this. If anyone understands my cryptic question-answering strategy and can help me out it'd be most appreciated.
######################################################################
+#################
sub register_form {
# --------------------------------------------------------------------
+------
# Output registration form.
#
my $self = shift;
my $errs = shift;
my $q = $self->query();
$self->set_session($q->cookie('SID'));
my $lang_bit = $self->{session}{lang} || $q->param('lang');
my $tmpl_path = "dynamic/" . $lang_bit . "_" . "register.shtml";
my $tmpl = $self->load_tmpl($tmpl_path, die_on_bad_params => 0);
$tmpl->param($errs) if $errs;
return $tmpl->output;
}
######################################################################
+#################
sub register_process {
# --------------------------------------------------------------------
+------
# Process registration form using CGI::Application::ValidateRM to c
+heck
# for blank required fields..
#
my $self = shift;
my $q = $self->query();
my ($results, $err_page) = $self->check_rm('register_form','_form
+_register_profile');
return $err_page if $err_page;
#.. do something with DFV $results object now
my $lang_bit = $self->{session}{lang} || $q->param('lang');
my $tmpl_path = "dynamic/" . $lang_bit . "_" . "register_success.s
+html";
my $tmpl = $self->load_tmpl($tmpl_path, die_on_bad_params => 0);
return $tmpl->output;
}
######################################################################
+#################
sub _form_register_profile {
# --------------------------------------------------------------------
+------
# Internal sub called from register_process to determine required
# form variables for registration form.
#
return {
required => 'email',
};
}
######################################################################
+#################
Error Message:
[Wed May 14 19:10:33 2003] [error] Error executing run mode 'register_
+process'. Eval of code '$self->register_process' resulted in error:
+Can't use an undefined value as a HASH reference at /usr/local/lib/pe
+rl5/site_perl/5.6.1/Data/FormValidator/Results.pm line 570.
- wil
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.