简体   繁体   English

zend形式的文本字段的自动完成功能-Zend Framework 2

[英]Autocomplete for the text field in the zend form - Zend Framework 2

Following the Album Module from Zend Framework 2 official site, I am planning to add the auto-complete function, for example in the Artist text field, I want to include the auto complete function such that when the user types in, I want to show a drop down list populated with the data similar to the one which the user is typing, so what is the best way to approach this problem. 继Zend Framework 2官方网站上的“相册模块”之后,我打算添加自动完成功能,例如在“艺术家”文本字段中,我想包括自动完成功能,以便在用户键入时显示一个下拉填充了类似于用户正在输入的内容数据列表,那么什么是解决这个问题的最好办法。 On searching the Zend Frame 2 site I have landed on this page . 在搜索Zend Frame 2网站时,我已经进入了此页面

I am not sure whether my approach is right approach or not, any guidance to proceed in the right way would be appreciated. 我不确定我的方法是否正确,以正确方式进行的任何指导都将受到赞赏。 Any example regarding this would also be helpful. 关于此的任何示例也将有所帮助。

如果您不知道什么是ajax,则应该开始学习ajax。.一旦您弄清楚如何做ajax,那么,如果您发现一些麻烦,则可以来这里进行一些代码建议,但是请先尝试一下

When going for Auto-Suggest today, you should ask yourself a single question: 今天进行自动建议时,您应该问自己一个问题:

How much data is the maximum for auto-suggest 自动建议的最大数据量是多少

Reasoning: 推理:

If the data is only few, ie if you have a list of Car-Vendors or something alike. 如果数据很少,即您有汽车销售商清单或类似清单。 Or futher, if you have a very limited amount of entries, then you should consider going the HTML5-way using DATALIST 或者,如果条目数量非常有限,则应考虑使用DATALIST进行 HTML5 导航

However, if the data changes often, and is quite big, then loading everything upfront is not the most ideal way and going for AJAX is the right thing to do. 但是,如果数据经常变化并且非常大,那么预先加载所有内容并不是最理想的方法,因此选择AJAX是正确的选择。 Nothing ZF2-Specific in here :) ZF2没什么特别的:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM