Issue is solved. The script disabled the button (wether it was
allready disabled or not), but this also causes to blur any field you
were in/on...
Issue solved with:
document.observe('dom:loaded', function() {
        new Form.Observer($('frmLogin'), 0.3, function() {
                if($F('txtEmail') != '' && $F('txtPassword') != '') {
                        $('submLogin').enable();
                } else if(!$('submLogin').hasAttribute('disabled')) {
                        $('submLogin').disable();
                        if($F('txtEmail') == '') {
                                $('txtEmail').focus();
                        } else {
                                $('txtPassword').focus();
                        }
                }
        });
});

The last if makes sure the empty field is focussed again, else you
could go back in browser history when holding backspace for example.
Also, autocomplete="off" could be removed now.

On Jan 3, 11:42 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Okay, I found out (thank you google) that the bug had something to do
> with Firefox's Autocomplete function. By adding autocomplete="off" in
> the <input> field the bug is fixed. However, the input field is still
> blurred approx every 0.3 seconds (the interval I set I'm guessing) and
> indeed, when I remove the code from the Form.Observer code, it doesn't
> blur anymore.
>
> I'm guessing it's got something to do with how I'm checking against
> empty fields???
>
> Any help would be great, thanks.
>
> On Jan 3, 1:39 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > I was trying something in Prototype (i'm brand new to it) and mucked
> > up this:
> > document.observe('dom:loaded', function() {
> >         new Form.Observer('frmLogin', 0.3, function() {
> >                 if($F('txtEmail') != '' && $F('txtPassword') != '') {
> >                         $('submLogin').enable();
> >                 } else {
> >                         $('submLogin').disable();
> >                 }
> >         });
>
> > });
>
> > now when trying it out live: i got following error in Firebug:
> > [Exception... "'Geen toestemming om eigenschap
> > XULElement.selectedIndex te wijzigen' when calling method:
> > [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e
> > (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame 
> > ::http://localhost/libs/js/prototype.js::anonymous :: line 3517" data:
> > no]
>
> > It's dutch but translates as Exception... "No permission to edit
> > property XULElement...... when calling method: "
>
> > Form.EventObserver works great, but it's a login field, so I'd want to
> > be able to press enter from the password field, instead of first
> > blurring the password field...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to