July 12th, 2001, 05:36 AM
Is it possible to lock the return key on a form, so it cant be pressed, and the form submitted.
July 12th, 2001, 09:54 AM
Sure. disable it. Something like: document.FORMNAME.BUTTONNAME.disabled=true;
Idea 2: Change the button so that instead of being type=submit, onclick="submitFunction();", or some such. In that function use whatever testing to decide if it will submit the form: document.FORMNAME.submit();
July 12th, 2001, 10:05 AM
You should be able to.
I would think all you would need to do is trap all keyboard activity and allow any trapped key except return carry on as normal while sinking a return keypress to a false return.
I know this can be done on text fields and form elements I am not 100% sure about the forms themselves but dont see why not.
Even if you cant do it on the whole form itself you can do it on each form element. Just on each element have the onKeyPress() event handler invoke a function that checks the keycode generated and filter out return keys (I THINK the return key code is 13, but again not 100% sure)
I hope this gets you in the right direction if you need more I will gladly post more later when I have my resources in front of me.
**Ive tried the disabled thing, didnt seem to work all the time across platforms, let me know if you try it and it does for you I will go back and see what I snafu'd **
Last edited by admap; July 12th, 2001 at 10:45 AM.