Latitudes
asked on
Get object label and value - jQuery Tagit
I'm trying to put constraints around text that can be entered into text box to only allow certain values to be selected. When selected, I want to extract the ID for the object to use later.
My thought was to use two boxes- one for the label that is visible to everyone and another for the ID that is hidden.
In short, how do I allow people to select "Pizza" in the text box and capture the value "1" in another field? If there are multiple values, a delimter "," should be used.
I'm open to suggestions as to how to make this work, but was trying to improve the UI by using TagIT (link below).
http://aehlke.github.com/tag-it/
My thought was to use two boxes- one for the label that is visible to everyone and another for the ID that is hidden.
In short, how do I allow people to select "Pizza" in the text box and capture the value "1" in another field? If there are multiple values, a delimter "," should be used.
I'm open to suggestions as to how to make this work, but was trying to improve the UI by using TagIT (link below).
http://aehlke.github.com/tag-it/
<input id="my_food" disabled="true">
<ul id="singleFieldTags"></ul>
var food = [{label:'Pizza', value:1},{label:'Burger',value:2},{label:'Salad',value:3}];
$("#singleFieldTags").tagit({
tagSource: food,
singleField: true,
singleFieldNode: $("#single")
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.