Forum: Rails Spinoffs (closed, excessive spam) onblur= ; focus()

Posted by few1938 (Guest)
on 2008-07-03 14:05
(Received via mailing list)
I recently posted a problem with re-focusing the cursor to a field
that had an 'onblur' event. The browser is FF3

I have found the following link that identifies the problem:
https://bugzilla.mozilla.org/show_bug.cgi?id=53579

Does prototype.js have a work-around or does anyone know a work-
around?

Frank
Posted by Trevan Richins (Guest)
on 2008-07-03 16:32
(Received via mailing list)
few1938 wrote:
> 
Try putting the focus() inside of a window.setTimeout.  So like this:

input.observe('blur', function() {
  window.setTimeout(this.focus);
});

I didn't test it but I've done things similar to get around the issue.
Posted by Frederick Polgardy (Guest)
on 2008-07-03 16:38
(Received via mailing list)
Watch out for binding/this issues if you're using this example - this 
isn't
bound inside the event handler:

input.observe('blur', function() {
       window.setTimeout(function() { Element.focus(input); });
});

-Fred

On Thu, Jul 3, 2008 at 9:31 AM, Trevan Richins <developer@ckiweb.com> 
wrote:

> Try putting the focus() inside of a window.setTimeout.  So like this:
>
> input.observe('blur', function() {
>        window.setTimeout(this.focus);
> });
>
> I didn't test it but I've done things similar to get around the issue.


--
Science answers questions; philosophy questions answers.
Posted by few1938 (Guest)
on 2008-07-03 16:41
(Received via mailing list)
The timeout issue has been discussed in the link.

Frank
This topic is locked and can not be replied to.