I have a couple Perl CGI pages where there are multiple submit buttons. This is necessary as I need to use the form data to make changes to a DB (For example modify, delete, activate).
I don't know what layer is responsible but it seems that whichever submit button is displayed first on the form that is the one that will execute when you click "Enter" on the keyboard.
Here is a sample of my Submit buttons for one page:
...
#
# Modify button
#
$cgi->submit(
-name => 'Action',
-value => 'Modify',
),
#
# Delete button
#
$cgi->submit(
-name => 'Action',
-value => 'Delete',
),
#
# Activate button
#
$cgi->submit(
-name => 'Action',
-value => 'Activate',
),
#
# Reset button
#
$cgi->submit(
-name => 'Action',
-value => 'Reset',
),
),
$cgi->end_form;
$sth->finish;
}
For this page I want the 'Modify' button to be the default (there are more submit buttons on the page that are inline with rows).
The closest thing I've found out there recommended using javascript submit buttons for all the buttons I don't want to be the default but, they said that I still needed to list the one I wanted as default at the top. That would defeat my purpose of placing the buttons any where and choosing one to be the default.
I also saw some options for possibly catching when the user clicks enter when using javascript.
Question: How can I set a default submit button when the user clicks the "Enter" key on a Perl CGI form, with multiple submit buttons, in any order?
Thank you for taking the time to look at this.