I made a pretty lengthy post on what I''m doing here:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/89a2b8e54a874dd9
Short version:
I have a radio_button group of two. If one is clicked another pair of
radio buttons is added, if the other is clicked it is removed.
observe_form does not work for elements added after initial page load.
observe_field does not work for radio_buttons except on the first
''click''
It was suggested that I stop observe_field before changes are made to
the form then restart it.
With much searching I found a Event.stopObserving method, but I''m not
certain how to apply this to my observe_form observer.
>From the source:
new Form.EventObserver(''process_call_form'', function(element,
value)
{new Ajax.Request(''/rails/assistant/add_element'',
{asynchronous:true,
evalScripts:true,
parameters:''Form.serialize(process_call_form)='' +
value})})
>From this I did:
function = "function(element, value) {new
Ajax.Request(''/rails/assistant/add_element'',
{asynchronous:true,
evalScripts:true,
parameters:''Form.serialize(process_call_form)='' +
value})}"
page << "Event.stopObserving(''process_call_form'',
''change'',
#{function})"
This doesn''t throw an error, but it doesn''t stop or
"reset" the
observer as far as I can tell either. new element are still unobserved
and old elements still are.
I tried using ''click'' instead of ''change'' as
well since the api docs
indicate that the default :on => option varies from buttons to other
elements.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---