Leser: 1
|< 1 2 >| | 13 Einträge, 2 Seiten |
1
2
3
param( 'VAR1', 'Neuer Wert');
#oder
hidden( -name=>'VAR1', -value=>'Neuer Wert', -override=>1);
hidden( -name=>'VAR1', -value=>'Neuer Wert');
textfield( -name=>'Inhalt' );
param('Inhalt', 'Das ist neu!!!');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use CGI qw( :all );
param( 'datum', time() );
param( 'text', 'Das ist der neue Text');
print start_form( 'form1' ),
hidden( 'datum'),
hidden('username'),
'Datum: ', textfield('datum'),
'Text: ', br(), textfield( 'text' ),
submit(),
end_form();
-override=>1
QuoteCREATING FILL-OUT FORMS:
General note The various form-creating methods all return strings to the caller, containing the tag or tags that will create the requested form element. You are responsible for actually printing out these strings. It's set up this way so that you can place formatting tags around the form elements.
Another note The default values that you specify for the forms are only used the first time the script is invoked (when there is no query string). On subsequent invocations of the script (when there is a query string), the former values are used even if they are blank.
If you want to change the value of a field from its previous value, you have two choices:
(1) call the param() method to set it.
(2) use the -override (alias -force) parameter (a new feature in version 2.15). This forces the default value to be used, regardless of the previous value:
print $query->textfield(-name=>'field_name',
-default=>'starting value',
-override=>1,
-size=>50,
-maxlength=>80);
1
2
3
4
5
6
7
my $cgi = CGI->new;
my $params = $cgi->Vars;
print $cgi->textfield(-name=>'field_name',
-default=>$params->{field_name},
-size=>50,
-maxlength=>80);
|< 1 2 >| | 13 Einträge, 2 Seiten |