jquery - AutoComplete TextBoxList value is submitted as fetched from json -


i'm using autocomplete textboxlist prototype , having couple of questions on this.

i'm fetching values demodata.js file as

[{     "caption": "name1",     "value": "name1" }, {     "caption": "name2",     "value": "name2" }] 

now when i'm submitting value, data received @ servlet

[{"caption": "name1", "value": "name1"}] 

q1. need it's value name1 not whole thing, how can achieve it's value.

q2. want change delimiter selecting values. right after typing value if space given value selected in textbox, want change ,. when press , after value should selected in texbox.

// array var myarray = [{  "caption": "name 1",  "value": "name 1" }, {  "caption": "name 2",  "value": "name 2" }];  // read each index/object in array $.each(myarray, function (index, value) {  alert('-index: ' + index + ' -caption: ' + value.caption + ' -value: ' + value.value); });  // values of first index/object var first_caption = myarray[0].caption; var first_value = myarray[0].value;  alert('first caption , value in myarray: ' + first_caption + ':' + first_value); 

if alerts annoy you, replace alert console.log

demo


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -