如何在包含2个不同文本框的页面中使用socialengine上撰写消息中使用的自动补全功能?
我知道我们可以将它与id为“to”的文本框一起使用,以获得自动补全工作。但是我如何在另一个id为eventto的文本框上使用相同的自动补全呢?
发布于 2013-07-17 09:35:42
只需根据请求更改id (此处改为toe )
new Autocompleter.Request.JSON('toe', '<?php echo $this->url(array('module' => 'user', 'controller' => 'friends', 'action' => 'suggest'), 'default', true) ?>', {
'minLength': 1,
'delay' : 250,
'selectMode': 'pick',
'autocompleteType': 'message',
'multiple': false,
'className': 'message-autosuggest',
'filterSubset' : true,
'tokenFormat' : 'object',
'tokenValueKey' : 'label',
'injectChoice': function(token){
if(token.type == 'user'){
var choice = new Element('li', {
'class': 'autocompleter-choices',
'html': token.photo,
'id':token.label
});
new Element('div', {
'html': this.markQueryValue(token.label),
'class': 'autocompleter-choice'
}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', token);
}
else {
var choice = new Element('li', {
'class': 'autocompleter-choices friendlist',
'id':token.label
});
new Element('div', {
'html': this.markQueryValue(token.label),
'class': 'autocompleter-choice'
}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', token);
}
}
, onPush : function(){
}
});
https://stackoverflow.com/questions/17695738
复制相似问题