Man. this is a lot of work just to get this working. And I haven't successfully got it to even remotely work using Ajax. I think I'm going to seek out another solution. Even when I get it working with a static page, I still get this on each keydown event:
[Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://brain.solepixel.com/mochitest.html :: anonymous :: line 102" data: no] http://brain.solepixel.com/mochitest.html Line 102 I have used the AJAX onComplete function for "el.focus()" and that works fine, but the MochiKit stuff doesn't work. It doesn't see the content of the XHR before it tries to connect the text box. I also tried the prevenDefault() - basically i just set it at the end of the function so it should alert the keycode, then use the preventDefault, but the key still comes through, probably because of the Exception mentioned above. Thanks for the help everyone, but I'm getting nowhere fast on this. I think I can find a simple JavaScript solution somewhere. Sorry to bother. On Apr 15, 11:14 pm, "Matthew Kwiecien" <[EMAIL PROTECTED]> wrote: > I suggest looking at these two references to get the hang of > events:http://www.quirksmode.org/js/introevents.htmlhttp://www.quirksmode.org/js/events_compinfo.html > > You're going to test by key ranges basically. After the keypress event, > you'll test event.keyCode against the different key codes. If it matches a > restricted key code (or doesn't match an allowed one, depending on how you > approach it), you'll send an event.preventDefault; > > It should look something like this (warning: pseudo-code): > connect('elem','keypress',function(evt){ if (evt.keyCode < 43 or > evt.keyCode> 98) > evt.preventDefault(); }); > > I'd also suggest poking around here if you have any > issues:http://developer.mozilla.org/en/docs/DOM:element > > As for each key's codes, I'll leave that to you and google. ;p > > Hope this helps :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" 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/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---
