For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2005 > Turn off enctype









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Turn off enctype
Dermot Paikkos

2005-11-07, 9:55 pm

Hi,

I need to turn off the enctype attribute within a form but even if I
specify -enctype => 'application/x-www-form-urlencoded' I end up with
2 encoding types:

<form method="get" action="/cgi-bin/myscript.pl"
enctype="multipart/form-data" enctype="application/x-www-form-
urlencoded" name="myform">

The docs I have read say that application is the default but that
doesn't seem to be the case.

"For compatibility, the start_form() method uses the older form of
encoding by default. If you want to use the newer form of encoding by
default, you can call start_multipart_form() instead of
start_form()."

Does anyone know how I can omit the enctype from the form attributes?
Thanx.
Dp.

======== Form section ==========
....snip
print $q->start_form(-method => 'post',
-name => 'myform',
-enctype => 'application/x-www-form-urlencoded',
-action => "/cgi-bin/myscript.pl",
);
print $q->hidden('import','yes');
....snip
===========================
David Dorward

2005-11-07, 9:55 pm

On Mon, Nov 07, 2005 at 05:25:27PM -0000, Dermot Paikkos wrote:

> I need to turn off the enctype attribute within a form


Why?

> The docs I have read say that application is the default but that
> doesn't seem to be the case.


david@irish-sea:~$ perl -MCGI -e'print CGI->start_form()'
<form method="post" action="/-e" enctype="application/x-www-form-urlencoded">

Looks like the case to me (assuming you mean
"application/x-www-form-urlencoded" as "application" by itself isn't
any form of encoding.

If you were talking about "the default of the encoding isn't
specified", then URL encoding is the default of every browser I've
ever tried it with. In fact, its the default type mandated by the HTML
spec:

http://www.w3.org/TR/html4/interact...rm-content-type

--
David Dorward http://dorward.me.uk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com