M
Matthew Sims
Hello,
I have a form with 4 submits, each submit performs a different task
using PHP.
One of the submits is the real submit button and when my user enters
their password in the passwd text box I would like this particular
submit to activate when the user presses the enter key on the
keyboard.
Currently, the 1st submit button in the order is defaulted when
pressing the return key and that's not what I want.
Javascript is not my forte and after an hour of researching online
this is the closest to what I can find...though it doesn't work.
****************
<head>
<script language="JavaScript" type="text/javascript">
function showKeyValue(evt) {
var keyValue;
keyValue = window.evt.keyCode;
if (keyValue == 13) {
javascript:document.formWalkthrough.submit.submit();
}
return false;
}
</script>
</head>
<body>
<form method="post" name="formWalkthrough" action="index_walk.php">
....
<input type="submit" name="editmode"
style="font-size:12px;width:110px;" value="Edit Mode">
<input type="submit" name="shiftturnover"
style="font-size:12px;width:110px;" value="To Shift Turnover">
<input type="submit" name="view" style="font-size:12px;width:110px;"
value="View Reports">
<input type="password" onKeyPress="showKeyValue(event)"
name="enterPasswd" size="13">
<input style="margin-top:5px;" type="submit" name="submit"
value="Submit">
*** This is the submit I want activated when pressing enter from the
enterPasswd text field above ***
</body>
So what am I doing wrong?
~~
Matt
I have a form with 4 submits, each submit performs a different task
using PHP.
One of the submits is the real submit button and when my user enters
their password in the passwd text box I would like this particular
submit to activate when the user presses the enter key on the
keyboard.
Currently, the 1st submit button in the order is defaulted when
pressing the return key and that's not what I want.
Javascript is not my forte and after an hour of researching online
this is the closest to what I can find...though it doesn't work.
****************
<head>
<script language="JavaScript" type="text/javascript">
function showKeyValue(evt) {
var keyValue;
keyValue = window.evt.keyCode;
if (keyValue == 13) {
javascript:document.formWalkthrough.submit.submit();
}
return false;
}
</script>
</head>
<body>
<form method="post" name="formWalkthrough" action="index_walk.php">
....
<input type="submit" name="editmode"
style="font-size:12px;width:110px;" value="Edit Mode">
<input type="submit" name="shiftturnover"
style="font-size:12px;width:110px;" value="To Shift Turnover">
<input type="submit" name="view" style="font-size:12px;width:110px;"
value="View Reports">
<input type="password" onKeyPress="showKeyValue(event)"
name="enterPasswd" size="13">
<input style="margin-top:5px;" type="submit" name="submit"
value="Submit">
*** This is the submit I want activated when pressing enter from the
enterPasswd text field above ***
</body>
So what am I doing wrong?
~~
Matt