• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

show /hide data based on autocomplete results.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
I have a textfield in which im implementing autocomplete.the autocomplete functionality is called after the user types in the first 5 characters.Now my requirement is the user can still type in data even if it doesnt show up in the the div container.Say for example i create a textfield for cities.After the user types in the first 3 chars it shows me a list of cities .The user can pick one from that list ot type in the city if not found in the list.Now i need to show a message "city is found" next to the textbox if the user selects one from the autocomplete list else dont display message.

I have been able to show/hide the message but the problem is say the user first selects the city from the list so i show the message but for some reason its the wrong city the user hits the backspace and clears the value the message is still shown how do i hide it..In the testfield when the user changes the value i need to hide that message any suggestion how to do it.. Can soem one help me in telling what should i be doing to achieve this.is there any event i could use.


Thanks
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not familiar with Yahoo's libs, but sounds like you need to attach an "onChange" event to your input field. When that value changes, hide/show the "complete" message.
I think you can filter the actual key that is pressed in the onChange as well? Could be wrong, though.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have been able to show/hide the message



Now once user selects from the list you show the message. At this point capture the value or set a dirty flag.

When user again edits the field, capture the onKeyDown event and check if its backpsace to hide the message or you could do actual comparison of values
 
rubbery bacon. rubbery tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic