CGI.pm form query sometime return null value

Y

YesBalala

I am using CGI.pm, and getting the parameters similiar to the
followings,

use CGI::Carp qw(fatalsToBrowser);
use CGI qw:)all);
:
my $task = param('task');
my $username= param('username');

Then I have a debug log as the next line. From the debug log, look
like there are times where task and username return nothing, although
it's been entered in the form.

I have a debug script in java, and when I point the form to submit to
that debug script instead of this perl script, it works all the time.
Seems like the problem comes in the perl side.

Does anyone got an idea about this?

Bosco.

Bosco
 
Y

YesBalala

Your script will only ensure it's not empty, but I can ensure that the
value is there. I have a java script to check for empty form before
submitting, and when empty parameter occur, hit the refresh icon to
repost the data and now the script can get it. So, the entered data is
there, being kept in the client's browser somewhere, just it does not
pass thru to the script for the first time. Refresh (means repost)
will work (so user don't need to re-enter). Anyone got further idea on
this?

Bosco.

--
It never happened to me and it must be in your script.
Try:
my $query = new CGI;
if (param()) {
ensure_entered($query->param('username'));
} else {
#display your html form here
}
sub ensure_entered {
# make sure it is not empty
}


Bosco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top