I have an auto-suggest textbox. A user can either pick an already existing item in the database of type in a new one.
How do i keep track of the id if item was selected (Store the id of the list of items coming from the db)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you load the items from the DB, load it as a JSON string, so both the values and their associated IDs are passed into your javascript. You can even index it by the value:
Then, when you are going to submit to the DB again, just reference for the ID.