Calling Javascript Function

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.

Thanks,
steve

On 6 Mar 2008, at 20:52, Steve G. wrote:

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