Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

CGI Application and Forms

by wil (Priest)
on May 14, 2003 at 18:30 UTC ( #258195=perlquestion: print w/replies, xml ) Need Help??

wil has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: CGI Application and Forms
by markjugg (Curate) on May 15, 2003 at 16:06 UTC
    I helped wil with this off-site. The short term answer in was to add msgs=>{} to the profile. The longer term solution is for DFV to fail more gracefully in this case, or better, Just Work.

    Mark

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://258195]
Approved by krujos
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2021-04-17 01:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?