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 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 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 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. 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
Archived
This topic is now archived and is closed to further replies.