kiat has asked for the wisdom of the Perl Monks concerning the following question:
I've a question regarding the reading of form submission. The html form in question is as follows:
If the user clicks on the submit button 'doit', the submission is registered as desired. The value of the pwd field value is processed in the login sub.<form name="myform" action="lgoin.pl" method="post"> <table <tr><th align="center" colspan="2">Login</th> <tr><td>Password</td><td><input type="text" name="pwd" size="5"> +</td></tr> <tr><td align="center" colspan="2"><input type="submit" name="lo +gin" value="doit"></td></tr> </table> </form> # portions of cgi code my $doit = param('login'); my %functions = ('login' => \&do_login, 'logout' => \&do_logout, ); if defined($doit) { &{ $functions{$doit} }; } else { default_page(); }
However, if instead of clicking on the submit button, the user hits Enter after he has entered a value in the password field and while the cursor is still in the field, the form submission is not detected correctly.
How do you ensure that whether it's the button or Enter that is hit, the form submission is processed correctly?
I hope I've described what I'm trying to achieve in as clear a manner as possible.
I look forward to your enlightenment :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Form submit detection...
by edoc (Chaplain) on Dec 12, 2003 at 02:44 UTC | |
by kiat (Vicar) on Dec 12, 2003 at 02:56 UTC | |
by edoc (Chaplain) on Dec 12, 2003 at 04:10 UTC | |
|
Re: Form submit detection...
by etcshadow (Priest) on Dec 12, 2003 at 03:38 UTC |