Re: Cannot retrieve empty keys from request using Apache2::Request.param

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Tommaso Torti wrote:
> Hi all,
> 
> i'm using mod_perl in order to retrieve all keys from a POST request with:
> 
> my $request = Apache2::Request->new($r);
> my $data = $request->param();
> 
> When i receive something like
> key1=value1&key2=&key3=value3
> $data contains all 3 keys
> 
> but with
> key1=value1&key2&key3=value3
> $data contains only 2 keys: key1 and key2&key3
> 
> Is there a way to retrieve all the 3 keys like the first case? Any suggestions?
> Thank you,
> 
As far as I know, there isn't a way, because the browser will not send any data for an 
input field that is empty in the <form>.

If you want to do that, then you would need some javascript inside the form, which fills 
the empty fields with some "dummy" sequence (like "--empty--"), before posting the form.
Then your module/script would need to catch such fields, and consider them as empty.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.