View Full Version : submitting forms
ClubCosmic
08-05-2004, 12:02 AM
i have a form that will only submit with a mouse click. how can i get it to submit with the enter button on kb. i am using php but dont want to change much code.
thanks :confused:
submiting a form is a clientside action, so you'll need to do this with clientside scripting (like Javascript). If you run a google forthat, then you'll probably get a few hundred links to examplecode.
The PHP codei only ran aftert the form was submitted and the file in your action-attribute is called.
ClubCosmic
08-06-2004, 12:13 AM
correct
also, i have another form that does submit on a enter click (i noticed that the submit button is highlighted )
well,
normally when you load a form, the submitbutton will be highlighted as soon a you place focus on a formelement.
For instance, if you reply to this post, you'll see that the 'submit reply' button is initialy not highlighted. As soon as you click inside the textarea, it gets highlighted.
If you leave the textarea, and then hit enter, then the form will be submitted(since the submitbutton is still highlighted.) (unless you hit the tabs a few times to move the focus to another element.
If you only use textfields, checkboxes, radiobuttons, then the form will always be submitted on enter.
if you use textareas, listboxes, dropdowns, buttons, then the form will not be submitted if the focus is on one of these formelement.
So it's not realy something to rely on. better use a small javascript.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.