views:

12

answers:

1
<%= observe_form :date_range_filter, 
        :frequency=>0.5,
        :update=>'perfomance',
        :url=>{:action=>'filter_date_range'},
        :before => "startLoad('perfomance');",
        :complete => "stopLoad('perfomance');" %>

I have two fields: date_after, and date_before

how do I get the observer to wait till both have data?

A: 

The rails doc (http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html) shows that you can use the ":condition" option with observe_form: "Use this to describe browser-side conditions when request should not be initiated.".

So something like:

:condition => "$('field1').value != '' && $('field2').value != ''"

will probably work.

vegetables