Scriptaculous autocompleter in Domino form

This post describes briefly an implementation of Scriptaculous’ Ajax.Autocompleter class.

It uses an AJAX request using a Page element for an @DBLookup I believe first mentioned at Lotusphere 2007 by Jack Rattcliff and later (?) by Jake Howlett in his http://www.codestore.net/store.nsf/unid/BLOG-20060221 and perfectionized (?) by my collegue Tomas.

Scriptaculous autocompleter needs an unordered list in return. For instance this list might be returned after the user typed the letter “y”:

<ul>
    <li>your mom</li>
    <li>yodel</li>
</ul>

Some examples use an agent to return the unordered list, others describe using a page.

The demo allows you to fill in multiple fields after clicking on one of the presented suggestions by splitting the responseText:

autocompleter form

In demo-mode it would look something like this:

demo autocompletion

For downloading a working example click here.

13 thoughts on “Scriptaculous autocompleter in Domino form

  1. Stephen Hood 2007-November-3 / 6:45 pm

    The nsf seems to be encrypted and can’t be opened..no problem with a few of your other ones.

    Btw.. Just came across your site recently. Nice stuff for those doing mostly Notes devs and shifting some stuff to web based apps. Thanks..

  2. quintessens 2007-November-4 / 12:52 pm

    Hi Stephen

    I thought I especially set the option ‘do not locally encrypt this database’. I am having some problems with my Notes 8 client which seems to want to locally encrypt every DB by default (thanks IBM for creating a jungle of client settings) so hopefully the problem is related to different clients? (I checked the db on my client and it has no local encryption it says…)

  3. Phil 2007-November-4 / 3:12 pm

    I get the encryption problem as well, I’m using R8. Thanks Phil.

  4. quintessens 2007-November-4 / 8:52 pm

    i created a new download, i hope this one works better ?

  5. Phil 2007-November-5 / 4:46 pm

    I’ve managed to open the app now – thanks, but the AJAX type-ahead doesn’t seem to work, I’m using R8 server, IE7

    Thanks again – Phil.

  6. quintessens 2007-November-5 / 10:36 pm

    Hi Phil, I run IE6 myself… do you type in a value that is ON the documents?

    here I have no problem with the type ahead… sowwy!

  7. Stephen Hood 2007-November-15 / 5:15 pm

    Thanks. It’s now working in both Firefox 2.x and IE 6.x and I’m using Notes 8.

  8. Sherwin 2008-January-14 / 4:27 am

    It worked for me, and I even managed to apply it on my database. My question now is how do I put the value of a form field to the parameter “lookupprefix”? If I hardcode a value to “lookupprefix”, it worked. But when I tried to use $(‘fieldname’).getValue, it doesn’t work. Any suggestions?

  9. Sherwin 2008-January-14 / 6:04 am

    I’m trying to populate a 2nd field based on the 1st field. I’m trying to get the value from the 1st field and put it in the lookupprefix, so that the options inside the 2nd field would only show those related to the 1st field. Using $F(‘fieldname’) doesn’t work either. But when I alert $F(‘fieldname’), it shows the value.
    document.forms[0].fieldname.value also doesn’t work.
    But when I hardcode a value in lookupprefix, it works.
    How do I put value in lookupprefix that is not hardcoded, that is based on a field? Thanks.

  10. quintessens 2008-January-22 / 1:45 pm

    @Phil, the problem lies with IE7. I need to look for a fix…

  11. quintessens 2008-January-23 / 12:29 pm

    here is the bug fix:

    in the HTML Head Section a variable for the URI is defined like this:

    var appURI = ‘//” + SERVER_NAME + “/” + @WebDbName + “‘” + @NewLine

    this should be

    var appURI = ‘http://” + SERVER_NAME + “/” + @WebDbName + “‘” + @NewLine

    in order to have it working correctly in IE7, sorry for teh inconvenience…

  12. Rajni 2008-April-23 / 12:34 am

    This nsf doesn’t work for me..I am using R7.0.3 & IE 7 and i fixed the line you mentioned above.

    thanks in advance
    Rajni

  13. Jerry Shelley 2008-July-29 / 6:06 pm

    Excellent, thanks. Works great on R8.01 client and Firefox 3.

    (Hate the download site though, with all the popups, flashpasts, pretend buttons that are actually adverts. Please reconsider using a more professional site, though err…umm.. I can’t think of any at the moment … ah yes http://www.megaupload.com/ )

Leave a comment