AJAX Observe Form - problem with event handlers with :on

Remove :frequency statement. In that case that will be event driven.

Cayce Balara wrote:

Cayce Balara wrote:

Aw crud on a stick - can it really be that simple? Could it really have been right in front of me as I stared at the api docs?

:frequency: The frequency (in seconds) at which changes to 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.   

I was hit the same brick time ago =) As an old geek I always like to see the actual code that's how I realized about it. Even if that was on front of me in documentation =)

Please note that it won't work with radio buttons. Stop! Probably it may if you will provide id name only on the last <input type=radiobutton> element! In that case you can safely update any DOM elements via observe_(field|form ) with :complete field and I don't have to use remote_function which is doesn't work properly with IE on radiobuttons. Cool! I have to check it.

Yes. Yes.

Thanks so much Sergey. :slight_smile:   

You are very welcome!

c.

Sergey Kuznetsov wrote:   

Remove :frequency statement. In that case that will be event driven.      All the Best! Sergey.

Cayce Balara wrote:

I also see that the RJS templates seem to trump the method I'm using in a major way. I just grabbed the O'Reilly RJS Templates for Rails booklet and it looks to be a gold mine.

c.    It looks like I will get my copy of that book soon =)))

Sergey Kuznetsov wrote:   

Cayce Balara wrote:     

Aw crud on a stick - can it really be that simple? Could it really have been right in front of me as I stared at the api docs?

:frequency: The frequency (in seconds) at which changes to 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.   

I was hit the same brick time ago =) As an old geek I always like to see the actual code that's how I realized about it. Even if that was on front of me in documentation =)

Please note that it won't work with radio buttons. Stop! Probably it may if you will provide id name only on the last <input type=radiobutton> element! In that case you can safely update any DOM elements via observe_(field|form ) with :complete field and I don't have to use remote_function which is doesn't work properly with IE on radiobuttons. Cool! I have to check it.

Yes. Yes.

Thanks so much Sergey. :slight_smile:   

You are very welcome!     

All the Best! Sergey.      All the Best! Sergey.

If you dive down into the source code, you find that the only :on value that has support at the JavaScript level is 'change' and that it is very specific. A few months ago I had to track down some unexpected behavior (or more accurately the lack of expected behavior) and discovered this. That was with Rails 1.1.6, but I think it's true at least as recently as 1.2.2

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com