jim.davidson Posted September 13, 2007 Share Posted September 13, 2007 When my form loads, how do I get the first field to be automaticly selected? (that is as if the user clicked in the field. I not sure what it's called, something in the back of my mind keeps saying "focused") Any help will be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/69214-solved-i-have-a-form-question/ Share on other sites More sharing options...
micah1701 Posted September 13, 2007 Share Posted September 13, 2007 yeah, this would be a javascript issue (not PHP) document.getElementById('yourField').focus Quote Link to comment https://forums.phpfreaks.com/topic/69214-solved-i-have-a-form-question/#findComment-347866 Share on other sites More sharing options...
Wuhtzu Posted September 13, 2007 Share Posted September 13, 2007 If you want the first field in your form to be focused you need javascript: http://javascript.internet.com/forms/field-focus.html http://www.jguru.com/faq/view.jsp?EID=289856 (just some google hits) Alternatively, which I prefer, you can specify the tabindex attribute for your fields. This will allow the user to easily jump through them with their tab-key. <input type="text" name="firstname" tabindex="1"> <input type="text" name="lastname" tabindex="2"> First tab will focus the firstname field and second tab will focus lastname field. Very nice Quote Link to comment https://forums.phpfreaks.com/topic/69214-solved-i-have-a-form-question/#findComment-347867 Share on other sites More sharing options...
jim.davidson Posted September 13, 2007 Author Share Posted September 13, 2007 Sorry for being in the wrong place. Thanks for the leads. Quote Link to comment https://forums.phpfreaks.com/topic/69214-solved-i-have-a-form-question/#findComment-347875 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.