more useful options | |
PerlMonks |
CGI form 'falls through' without capturing anythingby chexmix (Hermit) |
on Jan 10, 2017 at 21:04 UTC ( [id://1179356]=perlquestion: print w/replies, xml ) | Need Help?? |
chexmix has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Although I am grateful to still have hair remaining, I am pulling it out over an ostensibly simple CGI program I am trying to modify. The interface keeps getting hit by bots and this results in cleanup time for yours truly -- so I was asked to put a simple CAPTCHA-type interface on this ca. 2000 or so CGI page. I'm using the Authen::Captcha module to do this. When the user is facing the front page s/he is asked to pick from a series of radio buttons - this is collected in a parameter 'CategoryRequest'. If this param is set, the program goes off and creates a new captcha object, then sends the user off to a page where this is displayed and a response is requested. Here's the code for that part, since it's the part causing me the headache:
... I'm expecting that sub to return to where I came from with the 'UserEntry' param filled in, so I can first validate the response and then make decisions based on the result ... ... but instead of waiting for the submit button to be pressed and the parameter to be duly defined, the program just swoops over or through the subroutine (whether I return things explicitly from it or not), assumes param( 'UserEntry' ) is empty, and displays both the UserEntry page along with an error page ("You haven't entered anything!") underneath it together in the same lump of html. Why does this 'fall-through' happen? The logic I'm employing is as follows:
How do I get the UserEntry section to 'wait' for the user to enter something? This feels like a far more basic question than I should have to be asking at this point in my learning, but ... here it is. Thanks, Glenn
Back to
Seekers of Perl Wisdom
|
|