如何使用rails3-jquery-autocomplete在rails 3中创建自动完成搜索表单?
我正在使用这个 gem:
https://github.com/crowdint/rails3-jquery-autocomplete
我在自动完成工作和创建简单搜索方面遇到困难。这就是我的观点:
16 - semantic_form_for vendors_path do |f|
17 - f.autocompleted_input :name, :url => autocomplete_vendor_name_home_index_path
该网址对我来说没有意义。
以下是输出 HTML:
<input data-autocomplete="/home/autocomplete_vendor_name" id="_vendors_name" name="/vendors[name]" required="required" size="30" type="text" class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
我不想创建新供应商,我想提交搜索...但首先尝试让自动完成功能正常工作。
建议?
I am using this gem:
https://github.com/crowdint/rails3-jquery-autocomplete
I am having difficulty making the auto-complete work and also to create a simple search. This is what I have in the view:
16 - semantic_form_for vendors_path do |f|
17 - f.autocompleted_input :name, :url => autocomplete_vendor_name_home_index_path
The url isn't making sense to me.
Here is the output HTML:
<input data-autocomplete="/home/autocomplete_vendor_name" id="_vendors_name" name="/vendors[name]" required="required" size="30" type="text" class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
And I don't want to create a new vendor, I want to submit a search...but first am trying to get the autocomplete to work.
Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的项目之一的示例:
查看:
An example from one of my projects:
view:
如果您不依赖于使用 jQuery-autocomplete,您可能最好尝试 'TokenInput' ,我我认为它更好用,而且上面还有一个railscast,总是很方便:)
http:// /railscasts.com/episodes/258-token-fields
希望这有帮助。
If your not tied to using jQuery-autocomplete, you might be better off trying 'TokenInput' instead, I think it's alot nicer to use and there is also a railscast on it which is always handy :)
http://railscasts.com/episodes/258-token-fields
Hope this helps.