今天在自己的项目里试了一下rails 的 text_field_with_auto_complete.
看完书上的例子之后感觉挺简单。按部就班的就开始了。
可是在自己的firefox上怎么也不行。用firebug察看了生成的xhr。发现一切正常。
返回的数据也对,而且firebug,server log都没有什么错误报告。
百思不得其解之后,放弃text_field_with_auto_complete.自己一步一步的写。
text_field, div , javascript, server 端的method都写好了。
应该万无一失了。可是问题依旧。
又是百思不得其解。
于是试了一下ie 6 和 ie 7,发现两种方法都可以工作。
然后就把注意力放在浏览器上了。
实在不明白firefox 和 ie 的内核到底有什么不同。但是同样的rhtml却生成了不同的html.
用书上的code从新试了一下。结果依然。
rhtml:
<%# codecite autocomplete %>
<p><label for="user_favorite_language">Favorite language</label><br/>
<%= text_field 'user', 'favorite_language' %></p>
<div class="auto_complete"
id="user_favorite_language_auto_complete"></div>
<%= auto_complete_field :user_favorite_language,
:url=>{:action=>'autocomplete_favorite_language'}, :tokens => ',' %>
<%# codecite autocomplete %>
html in IE:
<p><label for="user_favorite_language">Favorite language</label><br/>
<input id="user_favorite_language" name="user[favorite_language]" size="30" type="text" value="java" /></p>
<div class="auto_complete"
id="user_favorite_language_auto_complete"></div>
<script type="text/javascript">
//<![CDATA[
var user_favorite_language_auto_completer = new Ajax.Autocompleter('user_favorite_language', 'user_favorite_language_auto_complete', '/user/autocomplete_favorite_language', {tokens:','})
//]]>
</script>
html in Firefox:
<p><label for="user_favorite_language">Favorite language</label><br/>
<input type="text" value="java" size="30" name="user[favorite_language]" id="user_favorite_language" autocomplete="off"/><p>
<div class="auto_complete"
id="user_favorite_language_auto_complete"></div>
<script type="text/javascript">
//<![CDATA[
var user_favorite_language_auto_completer = new Ajax.Autocompleter('user_favorite_language', 'user_favorite_language_auto_complete', '/user/autocomplete_favorite_language', {tokens:','})
//]]>
</script>
firefox里多了一个 autocomplete=off。不知道为什么会这样。
尽管发现了区别,可还是不明白。因为书上说要先把浏览器的autocomplete关掉。所以我认为这不是什么错误啊。
继续百思,希望求解。
分享到:
- 2007-09-14 04:50
- 浏览 1537
- 评论(1)
- 论坛回复 / 浏览 (1 / 3601)
- 查看更多
相关推荐
date: checks that the field is a valid date/datetime format ( if customFormat is set, checks with customFormat ) nocheck: It does not check anything except the emptyness of the field. For most of the ...
SCGCQ00475159 (DFCT) - While printing the ldinfo, there are some tabs instead of spaces for indentation so replaced all tabs with spaces. SCGCQ00531245 (ENHREQ) - Display the NCQ enabled/disabled ...
+ DeleteField now has optional "Contents" parameter to delete a certain field with contents + the text writer now understand the option -softlinebreaks to create a \n at the end of every line. In ...
Field test 5, released 16-dec-2001 ?1997-2001 Angus Johnson & Anders Melander http://www.melander.dk/delphi/dragdrop/ ------------------------------------------- Table of Contents: ------------------...
for complete file and selected block (only if block is currently selected) - Data inspector to view decoded numbers - Built-in script interpreter! Refer to online help for details - Easily works ...
compatibility with older or less security conscience applications. We ; recommending using the production ini in production and testing environments. ; ...
When returning from ftmPanning mode the complete client area repainting will perform. - ADD: Added TFlexPanel.FrostPanFullDoc property. When true then in ftmPanning mode the whole document image ...
Planning note If you're already using the library, I'm looking at redesigning some of the core...TokenAutoComplete is an Android Gmail style token auto-complete text field and filter. It's designed to ha
that scrolls text<END><br>81,mtymse.zip This is a control (VB5 with source) that controls every aspect of the mouse<END><br>82,progbar.zip Uses a picture box to emulate a progress bar<END><br>83...
matched snippet highlighting, field collapsing and search results grouping, spell checking, query auto-complete, querying by functions, and more. RETAIL SELLING POINTS Clearly-written comprehensive ...
matched snippet highlighting, field collapsing and search results grouping, spell checking, query auto-complete, querying by functions, and more. RETAIL SELLING POINTS Clearly-written comprehensive ...
(1KB)<END><br>66,XTrace_src.zip Extended TRACE macros with easy source navigation(3KB)<END><br>67,AutoSave.zip Add auto-save feature to Visual Studio 6.0.(41KB)<END><br>68,acomment.zip This ...
39. Display Rich Text fields in a view 86 40. Auto-Launch a file attachment 87 41. Showing a response count without showing the responses 89 42. 常用的几个按钮收集 91 43. 在WEB上从视图删除文档技巧 93 ...
39. Display Rich Text fields in a view 86 40. Auto-Launch a file attachment 87 41. Showing a response count without showing the responses 89 42. 常用的几个按钮收集 91 43. 在WEB上从视图删除...
Auto-complete polygon 工具生成共享边的多边形,配合snapping environment更好。 10. 画岛图 1).使用任务栏中的sketch工具,当画完外面的一圈时,右键 选择finish part 然后画中间的部分 再右键finish sketch ...
Display Rich Text fields in a view - **展示方法**: 通过配置视图列公式来显示富文本字段的内容。 #### 40. Auto-Launch a file attachment - **启动方法**: 在视图中配置列公式,使得点击附件时自动下载或打开...