TextExt jQuery Plugin And Hidden Field Value -
i have been playing http://textextjs.com/ weekend seems solid autocomplete plugin additional functionality might useful in future (like tagging). tried implementing in 1 location use own autocomplete functionality there 1 critical issue me plugin have yet find example/solution for.
i using following data structure:
[ { "id": "1", "title": "active", //etc.... }, { "id": "2", "title": "inactive", //etc.... }, //etc... ] now using ajax/autocomplete plugin right (though going need functionality tags plugin eventually). have custom itemmanager allows data data work fine here problem. want able set input users sees , interacts the object.title want have hidden input submitted form object.id. how type of functionality when using autocomplete/tags plugin?
i have tried @ ongetdataform since seems need create plugin implements (though me seems overkill have create plugin able set hidden input different visible one) if case, don't see how access full data object of item selected in autocomplete able set 2 field different. on great.
i don't think textext.js supports that, should pretty easy implement. before explain, please file issue in github makes (if haven't already).
have @ function https://github.com/alexgorbatchev/jquery-textext/blob/master/src/js/textext.plugin.autocomplete.js#l671
p.ongetformdata = function(e, data, keycode) { var self = this, val = self.val(), inputvalue = val, formvalue = val ; data[100] = self.formdataobject(inputvalue, formvalue); }; as can see, returns values input box directly. can here check in data array (self._suggestions) if user has typed far matches something. if that's case can use item matches , return id field.
does answer question?
Comments
Post a Comment