I am somewhat of a novice with CGI Perl and am working on a web app that uses 'mode' and 'action' variables to determine which pages load.
$mode = param('mode'); $action = param('action');
if ($mode eq 'page1') {
if ($action 'eq') {
&performAction; } displayPage1; } elsif ($mode eq 'page2') {
&displayPage2 } During development I have been having trouble figuring out the best way to set these variables when trying to navigate to different modes/actions after a form submit.
In some cases, putting a hidden value in the form will work
hidden(-name=>'action',-value=>'save') but sometimes it will not. In case of the latter, putting param('action',"save") before the form will make the action change when the form is submitted. I am unable to figure out why this happens though, are there factors that affect these two variables that I am unaware of?
What I now need to do is have two buttons on the same form, one which will just set the action to save the form data, and another which will save the form data but navigate to another mode/page with that form data.
If anyone could at least point me in the right direction for what I should be researching I would be greatly appreciative.
|