5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
package Widget; use base 'CGI::Application'; use strict; sub setup { my $self = shift; $self->mode_param( 'rm' ); $self->start_mode('mode1'); $self->run_modes( 'mode1' => 'showform', 'mode2' => 'showlist', ); } sub showform { my $self = shift; my $q = $self->query(); my $output = ''; $output .= $q->start_html(-title => 'First'); $output .= $q->start_form(-name => "first"); $output .= $q->textfield(-name => 'widgetcode'); $output .= $q->hidden(-name => 'rm', -value => 'mode2'); $output .= $q->submit(); $output .= $q->end_form(); $output .= $q->end_html(); return $output; } sub showlist { my $self = shift; my $q = $self->query(); my $output = ''; $output .= $q->start_html(-title => 'Second'); $output .= $q->start_form(-name => "second"); $output .= $q->hidden(-name => 'rm', -value => 'mode1'); $output .= $q->submit(); $output .= $q->end_form(); $output .= $q->end_html(); return $output; } 1;
QuoteNote, that just like all the other form elements, the value of a hidden field is "sticky". If you want to replace a hidden field with some other values after the script has been called once you'll have to do it manually:
param('hidden_name','new','values','here');
5 Einträge, 1 Seite |