Hi -- I'm working on something which has a form field to observe, and
corresponding stuff happening in a Flash widget which it also needs to
stay up to date on. What I've been doing is using Form.Element.Observer
to track the form field, and attempting to use JS variables to stay up
to date on the Flash widget stuff. First I tried to put the JS vars in
the "parameters" var of the new Ajax.Request in the
Form.Element.Observer, but it appears to be evaluating those vars
immediately, rather than passing them to Ajax.Request with the idea
"these are vars to evaluate every time you make a request". I tried
storing the field observer in a variable and creating a new one each
time, which goes into that variable, on the hopes that would cause
garbage collection to destroy the old field observers each time the var
was reallocated, or whatever, but that didn't work either.

In fact, what happened there, I ended up with a new observer with the
correct Ajax.Request parameters each time -- but the old ones weren't
destroyed, so I had a huge problem on my hands.

The new approach I'm about to set up is a form with hidden tags that
get manually reset by custom JS and a Form.Observer object. Then, every
time the other data outside the form gets changed, I change the hidden
tags, the Form.Observer notices the change, and blam, it updates as
it's supposed to, and everything works.

I just want to run this approach by the people on this list, and see if
it sounds sensible to you. Form.Element.Observer is obviously built
only to observe one field at a time, and Form.Observer was obviously
built to track all the fields in a form -- not built to track one form
field and some data concerning a Flash widget. However, it seems like
the best way to coordinate these things, unless some method of creating
an Ajax.Request with dynamic parameters exists.

Thanks,
Giles

http://www.gilesgoatboy.org
http://gilesbowkett.blogspot.com
http://gilesgoatboy.blogspot.com


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to