little hangy down thingy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

little hangy down thingy

Post by buckit »

You start typing in an input field and the browser drops down previously entered values.

I love that feature normally... but in a form I am creating you start to type in someones name and it uses ajax to populate a div below it with matches from a database... you click the one you want and it populates some other fields... problem is the browser is dropping down all the previous entries I have entered for testing and its covering the div I am populating.

is there a way to disable that? Im not sure what its technically called and 'prevent hangy down thingy' doesn't return what I want on Google LOL
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Re: little hangy down thingy

Post by JayBird »

Code: Select all

<input type="text" name="foo" autocomplete="off">
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: little hangy down thingy

Post by buckit »

perfect! knew it had to be something simple!

thanks!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: little hangy down thingy

Post by pickle »

Edit: I see ~Jaybird beat me to the punch. I'll post anyway because I have more info

There are a couple ways. First - you could name that field randomly. Something like this:

Code: Select all

<input type = "hidden" name = "field_name" value = "230afj" />
<input type = "text" name = "230afj" />
Second, add the "autocomplete" attribute like this:

Code: Select all

<input type = "text" name = "field_name" autocomplete="off" />
I think. I've never actually used it because it's not standards compliant. Almost all modern browsers implement it, but it's not part of a standard. Since you're using Javascript anyway, you could add the attribute with Javascript & still stay standards compliant.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: little hangy down thingy

Post by buckit »

Thanks for the further explanation. I thought about randomizing the name since thats how it knows to populate... but I figured there would be an easier way.

This is a basic project that needs up and running sooner than later and will only be used by 2 people who both exclusively use Chrome (dont ask, I dont know, not going to change) so thats the only thing it needs to work in for now... they will be fully aware of all limitations.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: little hangy down thingy

Post by pickle »

buckit wrote:they will be fully aware of all limitations.
Don't kid yourself. Oh sure - you may tell them the limitations, and they may grin & nod, but they'll forget.

Nonetheless, since you're in such a closed environment, the "autocomplete" attribute will work fine.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: little hangy down thingy

Post by buckit »

pickle wrote:Don't kid yourself. Oh sure - you may tell them the limitations, and they may grin & nod, but they'll forget.
trust me... I know how that goes! :) I have been dealing with these same 2 people for over 10 years... have come to know the best ways to communicate with them by now :)
Post Reply