On 6 Mar 2008, at 20:52, Steve Glaz wrote:
>
> Hello Everyone,
>
> I was wondering if it''s possible to do the following:
>
> I have an array of model objects(lets say items in my form) I would
> like
> to loop through this array and call a javascript function(that
> returns a
> boolean) on each element of the array. If true is returned I would
> then
> render a partial with the element. I am not sure how to call the java
> script function from the template as it is not triggered from any
> event.
>
This obviously has to happen client side, so when the conditions are
met an ajax called is triggered.
You say it is not triggered by any event, but that doesn''t really make
sense: it''s bound to happen in response to something whether that on
page load, when the user has populated the form, after some fixed
amount of time has elapsed etc... Work out when the code should run
(without thinking about the nitty gritty of the implementation) and
work back from there.
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---