A handful of comments inline:
On Aug 1, 2007, at 9:55 AM, boipster wrote:
> The problem is that I don't seem to be able to observe the password
> field. It doesn't matter what function I'm trying to kick off, I get
> errors saying the element has no properties or, when stepping through
> the code with firebug, could not convert Javascript argument.
I've never tried observing a password element. Have you tried
building a small proof-of-concept page (with an already existing pw
element) to test that it can be done, and isn't a browser restriction?
> Event.observe(window, 'load', function() {
> var checkAuth = new Ajax.Updater('uaDiv', '/auth/check', { method:
> 'get', asynchronous: false });
> Event.observe('password', 'keypress', 'catchEnterKey');
> });
Why are you firing an Ajax.Updater on page load, rather than just
loading the correct content the first time? Seems a bit odd.
> ...
>
> This leads me to believe that initially the form wasn't fully loaded
> and the password input was not there for addEventListener to use.
That's a reasonable guess, given the circumstances. Have you tried
putting the subsequent Event.observe in a setTimeout? e.x.
Event.observe(window, 'load', function() {
var checkAuth = new Ajax.Updater('uaDiv', '/auth/check', { method:
'get', asynchronous: false });
setTimeout(function() {Event.observe('password', 'keypress',
'catchEnterKey');}, 10);
});
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---