Lesson 7 | Widgets |
Objective | Learn about specific widgets and what they do. |
CGI.pm FORM defaults
CGI.pm FORM defaults
CGI.pm has very reasonable defaults for these form elements. These are as follows:
attribute |
default |
method |
method="POST" |
action |
action="myscript.cgi" or whatever your current cgi script is called. |
enctype |
enctype="application/x-www-form-urlencode" |
We should not ever need to change the enctype within our form (in fact we should avoid even trying to do so).
If you want to create a multi-part form (for uploading files etc) we create this in a different manner.
We must use this syntax for multi-part forms if we want CGI.pm to handle them properly. We create a multi-part form like this:
print start_multipart_form({-action=>"myscript.pl", -method=>"POST"});
# print form internals.
print end_form();
Perl Widget - Exercise