BlobFisk

msg:601050 | 4:16 pm on Oct 1, 2004 (gmt 0) |
How about using onkeypress on the input fields: function submitMe() { if (window.event.keyCode == 13) { document.myForm.submit(); } } |
| Then in your HTML: <input type="text" ... onKeyPress="submitMe()"> |
| This is off the top of my head and may be way off! HTH
|
StupidScript

msg:601051 | 4:20 pm on Oct 1, 2004 (gmt 0) |
Depending on how complex your form is, it should be able to be submitted by the user pressing "Enter" while focus is on any text field, by default. You should only need to put a script to trigger the submit function in fields which are not of the type="text".
|
BlobFisk

msg:601052 | 4:24 pm on Oct 1, 2004 (gmt 0) |
The behaviour of browsers should be that if the form only has one input then hitting return should submit the form. However, behaviour varies widely between the browsers!
|
kaled

msg:601053 | 11:09 pm on Oct 1, 2004 (gmt 0) |
I'm half asleep as I write this, but I think it is as simple as setting type="submit". I wrote a demo page some months ago (with three forms on a single page) and I think I tested it on IE, FF and Opera and all behaved correctly. Kaled.
|
limbo

msg:601054 | 10:09 am on Oct 8, 2004 (gmt 0) |
Whoops I do apologise, forgot to say thanks for the replies. Unfortunately none of the suggestions seemed to work. I have aquired the page from another. Code: <form name="frm"> Enter password <input type="password" name="pswd" size="6"> <input name="button" type="button" onsubmit="loadpage(target)" onClick="loadpage(target)" value="Proceed"> </form> |
| Thanks, Limbo.
|
kaled

msg:601055 | 2:03 pm on Oct 8, 2004 (gmt 0) |
Change type="button" to type="submit" and delete the OnClick value. Finally, set <FORM OnSubmit="return processForm();"> where processForm is the name of your validation function. It must return true to permit form submission to proceed. Kaled.
|
|