ldoozer Posted November 30, 2006 Share Posted November 30, 2006 anyone know the best way to tell a form to submit when a user presses the return key.so they type username then press tab to next field, then type password and when they press return the form is submitted??? Link to comment https://forums.phpfreaks.com/topic/29024-tell-a-form-to-submit-when-user-presses-return-key/ Share on other sites More sharing options...
ToonMariner Posted December 1, 2006 Share Posted December 1, 2006 I think IE does that automatically - and users of browsers that don't will know that they can't hit return to submit. Other wise you will need an even on the entire document like onKeydown and check the code for return (can't remeber what it is!) all in js. As you should not rely on js I think it best to not even bother trying to do this.Just give them a form and a submit button - at least browsers will understand what they are supposed to do then. Link to comment https://forums.phpfreaks.com/topic/29024-tell-a-form-to-submit-when-user-presses-return-key/#findComment-133106 Share on other sites More sharing options...
wafflestomper Posted April 14, 2007 Share Posted April 14, 2007 I understand what you are saying, but it's not necessarily true. I want the user to be able to press the return key and the form to be submitted, much like is done in this forum in the search field. I don't have to tab to the "Search" button and then hit return... I just type in the search field and hit return and it knows I want to submit. On the form I just set up, it doesn't work like that. How do you get it to do that? Link to comment https://forums.phpfreaks.com/topic/29024-tell-a-form-to-submit-when-user-presses-return-key/#findComment-229305 Share on other sites More sharing options...
fenway Posted April 20, 2007 Share Posted April 20, 2007 If it's just a single text input in a form, I believe that's the default action... but you can always trap the key press. Link to comment https://forums.phpfreaks.com/topic/29024-tell-a-form-to-submit-when-user-presses-return-key/#findComment-233922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.