On Nov 12, 2010, at 9:08 PM, MDM wrote:
With thanks to "themiddleman" and "agnaki" somewhere out there in the
ether, I have solved the problem:-
Use respondToChange not respondToChange()
As the parensthesis () execute the function wheras without () it
references it.
$('search').observe('change', respondToChange()); only triggers when
the focus is moved away from the text_field.
new Form.Element.Observer(
'search',
1,
respondToChange()
) }); ................................repeatedly checks the text_field
and call the function every 1 second if there is a any change.
I now only have one small problem.
How to call the "form_tag" from the function.
Anyone have any ideas.
You might try this.up('form') inside your function, as inside the
anonymous function, this is set to the 'search' field. If that doesn't
work, you can always do it long-hand with myForm = $
('search').up('form').
Walter
--
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 [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-talk?hl=en.