首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >socialengine上的自动完成好友列表

socialengine上的自动完成好友列表
EN

Stack Overflow用户
提问于 2013-07-17 17:12:03
回答 1查看 354关注 0票数 2

如何在包含2个不同文本框的页面中使用socialengine上撰写消息中使用的自动补全功能?

我知道我们可以将它与id为“to”的文本框一起使用,以获得自动补全工作。但是我如何在另一个id为eventto的文本框上使用相同的自动补全呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-17 17:35:42

只需根据请求更改id (此处改为toe )

代码语言:javascript
代码运行次数:0
运行
复制
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(){
        }
      });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17695738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档