提交 fd9c15e4 编写于 作者: J Jamis Buck

Fix observe_field to fall back to event-based observation if frequency <= 0...

Fix observe_field to fall back to event-based observation if frequency <= 0 #1916 [michael@schubert.cx]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2104 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 97adfdaa
*SVN*
* Fix observe_field to fall back to event-based observation if frequency <= 0 #1916 [michael@schubert.cx]
* Allow use of the :with option for submit_to_remote #1936 [jon@instance-design.co.uk]
* AbstractRequest#domain returns nil when host is an ip address #2012 [kevin.clark@gmail.com]
......
......@@ -305,9 +305,10 @@ def define_javascript_functions
#
# Additional options are:
# <tt>:frequency</tt>:: The frequency (in seconds) at which changes to
# this field will be detected. Set this to a value
# greater than zero to use time based observation
# instead of event based observation.
# this field will be detected. Not setting this
# option at all or to a value equal to or less than
# zero will use event based observation instead of
# time based observation.
# <tt>:update</tt>:: Specifies the DOM ID of the element whose
# innerHTML should be updated with the
# XMLHttpRequest response text.
......@@ -319,7 +320,7 @@ def define_javascript_functions
# Additionally, you may specify any of the options documented in
# +link_to_remote.
def observe_field(field_id, options = {})
if options[:frequency]
if options[:frequency] and options[:frequency] > 0
build_observer('Form.Element.Observer', field_id, options)
else
build_observer('Form.Element.EventObserver', field_id, options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册