[prev in list] [next in list] [prev in thread] [next in thread]
List: cgiapp
Subject: bug in CGI::Application ?
From: tomasz konefal <twkonefal () yahoo ! ca>
Date: 2002-01-15 17:07:02
[Download RAW message or body]
hello list,
i'm having trouble invoking successive run modes in my application. i
start in run mode 4 which calls run mode 5. run mode 5 then has a little
button to go back to run mode 4. the problem is that the html that is
generated in mode 5 ALWAYS says to go to run mode 5 instead of the mode i
specify. am i doing something wrong, or is something the matter with
CGI::Application?
thanks,
twkonefal
here is the relevant portion of my module:
---snip---
sub setup {
my $self = shift;
$self->run_modes(
'mode_1' => 'login_form',
'mode_2' => 'login_retry',
'mode_3' => 'mainmenu',
'mode_4' => 'create_account',
'mode_5' => 'create_results',
);
$self->start_mode('mode_4');
$self->mode_param('rm');
## other setup stuff
## connect to a db, etc
## $self->param('mydbh'=>DBI->connect());
}
sub create_account {
my $self = shift;
## get CGI query object
my $q = $self->query();
## set up templates
my $head = $self->load_tmpl('base-head.tmpl');
$head->param(page_name => 'create account',
opt_logout => 1 );
my $foot = $self->load_tmpl('base-foot.tmpl');
$foot->param(image => 'images/cat2.gif');
my $body = $self->load_tmpl('createaccount.tmpl');
# fetch from DB later
$body->param(
folder_num=>'340',
name=>'Tomasz Konefal',
address=>'address',
postalcode=>'code',
phonenumber=>'number',
loginname=>'loginname'
);
## start our html code
my $output = '';
$output .= $head->output();
$output .= $q->start_form();
## set the new run mode when user hits 'submit'
$output .= $q->hidden(-name => 'rm', -value => 'mode_5');
## THIS LINE WORKS OKAY ^^^^
## guts of login form page
$output .= $body->output();
$output .= $q->end_form();
$output .= $foot->output();
return $output;
}
sub create_results {
my $self = shift;
## get CGI query object
my $q = $self->query();
# set up templates
my $head = $self->load_tmpl('base-head.tmpl');
$head->param(page_name => 'create results',
opt_logout => 1 );
my $foot = $self->load_tmpl('base-foot.tmpl');
$foot->param(image => 'images/cat4.jpg');
my $body = $self->load_tmpl('createresults.tmpl');
$body->param(
loginname=>$q->param('loginname')
);
## start our html code
my $output = '';
$output .= $head->output();
$output .= $q->start_form();
## set the new run mode when user hits 'create another'
## $output .= $q->hidden(-name => 'rm', -value => 'mode_3');
$output .= $q->hidden(-name =>'rm', -value => 'mode_4');
## THIS LINE ^^^^^ IS BROKEN
## CHANGING -name to anything EXCEPT 'rm' prints out correctly
## in the resulting HTML source, but of course,
## the run modes are not affected :(
## guts of the results
$output .= $body->output();
$output .= $q->end_form;
$output .= $foot->output;
return $output;
}
---snip---
______________________________________________________________________
Web-hosting solutions for home and business! http://website.yahoo.ca
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic