Forum Moderators: open
To make the 'submit' button work when the "Enter" key is pressed (as it does with the standard form buttons), we added the javascript function below. It is called with onKeyPress in the body tag of the page with the form.
function checkEnter(event)
{
var code = 0;
if (NS4)
code = event.which;
else
code = event.keyCode;if (code==13) {document.forms[0].submit();
}
The code works fine for submitting the form. The only problem is that, whenever it is called (that is whenever you try to submit the form by pressing "Enter" when the focus is not already on the button), many of our machines let out the noisy "ding" that usually accompanies a warning message.
Any ideas on how we can get rid of the noise?
hth
Can you hide a submit button by making it 1px-by-1px
Well, that's very close to the solution that finally hit me early yesterday afternoon. I added the following to the bottom of each form:
<input type="submit" value="Submit" class="hidden">
Then, in the stylesheet I wrote:
.hidden {
height:0px; width:0px;
}
It struck me as too simple, but it works beautifully --people can still click on the visible graphic button (or tab to it), or simply hit "Enter". (I have now removed the javascript function from these pages. Still trying to find a glitch, but nothing so far. . . )