pktm wrote:
Am Mon, 02 Aug 2004 16:51:49 -0400 schrieb Michael <[EMAIL PROTECTED]>:
pktm wrote:
I have a fillout-form with 2 buttons in which users have to review their given information from a further form.
If the one button (named 'back') gets clicked, the user want's to change his given information.
Else, he would submit his data.
Now, I thougt i can check for the runmode ('save') given in the review-form by a hidden-field and set the correct runmode.
[snip]
sub cgiapp_prerun {
     my $self = shift;
     if( $self->get_current_runmode() eq 'save' ){
         my $q = $self->query();
         if( defined($q->param('back')) ){
             $self->prerun_mode('showForm');
#print STDERR $self->get_current_runmode();
             $q->param(-name=>'error', -value=>1);
         }
     }
} # /cgiapp_prerun

This doesn't work.
Anytime the button 'back' gets clicked, I saw the fillout-form AND the review-form.
The output to STDERR returns 'save', although I set it to 'showForm'...


What is the name of your submit button? Is it 'back' or is that just the value? Did you make sure that your call to prerun_mode is getting run? Put in a debug print/die/warn statment inside the if( defined($q->param('back')) ) block just to make sure.

The button is named back, its value is "<< zur�ck": <input type="submit" name="back" value="&lt;&lt; zur&uuml;ck" />
print STDERR $self->get_current_runmode(); returns 'save', so the sub cgiapp_prerun is called.

I'm sorry. I was just looking through the code and the prerun_mode() doesn't actually change the value of the current run mode. It saves it for changing. The change doesn't actually take place until after your cgiapp_prerun has finished. Instead of catching the runmode from get_current_runmode() while inside of your prerun, use prerun_runmode().


So instead of
    print STDERR $self->get_current_runmode();
you should use
    print STDERR $self->prerun_runmode();

I don't know if this is an intended feature or not. I would seem to me that prerun_runmode should change the current_runmode, but you may have to complain loudly to get this changed since the above changes would work.

HTH

Michael Peters
Developer
Plus Three, LP

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to