Hey there,
Collin's solution is not without merit, but it needlessly duplicates a
lot of s.a.us code. What you need to react to your in-field typing is
either a Form.Element.EventObserver object (based on onchange) or a
Form.Element.Observer (periodical value change check), both being
provided by Prototype.
Just hook up a small callback function of yours that will simply take
the field's value (2nd argument) and invoke a Ajax.Updater the usual
way. Example:
function fetchDataFromServer(elt, value) {
new Ajax.Updater('yourContentsContainer', '/your/url', {
parameters: 'yourServerField=' + encodeURIComponent(value)
});
} // fetchDataFromServer
new Form.Element.EventObserver('yourInputId', fetchDataFromServer);
If you need time-based check for on-the-fly typing, use F.E.Observer
instead, e.g. :
new Form.Element.Observer('yourInputId', yourIntervalInSecs, fetch...);
The interval can of course be floating-point, but I advise using one for
a better overall user experience.
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---