freelance84 Posted August 27, 2010 Share Posted August 27, 2010 In a simple text field in a form.... the browser automatically offers a list, when either when you click in or start typing in the field, of previous entries. My question is: Does anyone know how to control this? Is it possible to give a list of values to the browser, sort of like a ajax search, but all sent before. For example; in one field the user must enter a name, i want the text box to offer name possibilities even before the user has entered any on the form previously... sort of combining the <text> with a <select> menu... with all the name possibilities coming from a mysql table Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/ Share on other sites More sharing options...
Adam Posted August 27, 2010 Share Posted August 27, 2010 The browser only suggests what you've entered before; the only control over that you have is to disable it with the autocomplete attribute. You could use JavaScript though to create the suggestions? jQuery a couple of plug-ins that would make things a lot easier for you too.. http://docs.jquery.com/Plugins/Autocomplete Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/#findComment-1104286 Share on other sites More sharing options...
freelance84 Posted August 27, 2010 Author Share Posted August 27, 2010 Is there a way to do this without js that you know of? Just using mysql php and html? Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/#findComment-1104288 Share on other sites More sharing options...
Adam Posted August 27, 2010 Share Posted August 27, 2010 No I'm afraid not. You need JavaScript for it's event handling (i.e. 'onkeyup') to be able to trigger the code at the right time. Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/#findComment-1104290 Share on other sites More sharing options...
freelance84 Posted August 27, 2010 Author Share Posted August 27, 2010 alright, cool cheers Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/#findComment-1104291 Share on other sites More sharing options...
Shp0ngl3 Posted August 27, 2010 Share Posted August 27, 2010 Easiest way would be jQuery. Adding the autocomplete is aprox 7-8 lines of codes for a basic one Quote Link to comment https://forums.phpfreaks.com/topic/211861-combining-and/#findComment-1104293 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.