
Some time ago I posted our AJAX NAB picker for public consumption. It has been pretty popular, but Ben Dubuc found and fixed a few issues and has posted it on his site.
You can download the updated/fixed code here or from his site.
Thanks, Ben...much appreciated!
1. Michael Smelser08/20/2007 11:24:50 AM
Homepage: http://www.lotus911.com/blogs/smelser.nsf
Hi Scott,
This is great! Thanks. Hope things are going well for you at TS.
2. Elaine Nelson08/22/2007 11:31:19 AM
I love this - it is terrific. I copied the required pieces into my application to select single name and it works almost perfect for me on the first try. The names are not showing in the "from:" field. It is displaying the names from the correct NAB for me and in IE it returns the selected name to my field. Firefox is not liking it though and says "There has been an error returning the selected values: undefined". I've doubled checked the instructions for installing - what have I missed? Help me.
3. Belgi09/04/2007 03:26:26 AM
Hi,
I'm getting same error message? And I'm trying to use example database, I didnt do anything change.
br,
Belgi
4. Scott Good09/04/2007 08:52:10 AM
Homepage: http://www.scottgood.com
Hm...whaddya know? It turns out there's a function in there called getURLParam() which is used to strip parameters out of the URL. In other words, if your URL includes something like "...?Open&name=Dave%20Jones...," using getURLParam("name") will return "Dave%20Jones" to your code.
However, getURLParam() has--or should I say 'had'--a "toLowerCase()" call in the middle of it which was probably put there to try to get the parameter names all to lower case in case you fat-fingered it.
Unfortunately, what it did was lowercase everything which, in this case, included the target field name.
So, where the code was supposed to be returning a field name like "SingleName," it was instead returning "singlename." With the case wrong, this code shouldn't have worked anywhere but IE, apparently, is willing to run loose enough with the rules to let it slide by.
Go figure.
In any case, I've updated the code in the download so that if you can see this posting the link is good again (09/04/2007 8:50 AM EST)
Sorry for the hassle.
Scott
5. Joseph LeMay09/04/2007 11:14:41 AM
Homepage: http://www.joelemay.com
some of the URLs you have in the comments are no longer valid.
in particular this one,
getInnerText function courtesy of Martin Honnen
http://www.thescripts.com/forum/threadedpost582930.htmlktjb1rugdt
and this one
http://www.fclonline.com/Articles/GetURLParameterinJavascri.html
from the js header of the (AJAX NAB picker multi) form.
6. Jim Anderton01/10/2008 01:25:41 PM
Homepage: http://www.withat.com
Just wanted to drop a quick "thanks" for keeping this little gem available. I found it a while back and it's proven quite useful. Nice work.
-Jim
7. Willy Hubert04/15/2008 11:34:28 AM
Hi, Thanks for this great application. Just a quickie - I have installed this on a Domino 8.0 server in the same way as I did on a 6.1 and I get a wierd error. It shows the 4 entries in the address book (on test server) and says showing 1 to 4 of 20080415 records! Then if I pressed next it gives me an error "There has been an error displaying the data:
Object required (TypeError)". Any ideas? Thanks
8. Willy Hubert04/16/2008 03:20:20 PM
This is an update on the above issues. I have had a look at the issues above (althought I'm no AJAX, XML or JavaScript expert and this is where I have got to). There seems to be 2 issues:
1. The Object required (Type Error) is caused by there being a number of entries in the NAB less than the count (as in number displayed per page). In my case I was testing on a test server with only 4 entries in the NAB. There should be a code correction in the nextPage() function at this point.
(I can submit an updated DB if you want?).
2. When I tested this on an 8.01 server it was giving me a count of 20080415 records in the NAB. I then realised this wasn't a count it was a date! On the 6.52 server it parses the <viewentries >XML (for the names.nsf/($VimPeopleByLastName)?readviewentries&count=16) as:
<viewentries toplevelentries="4">
and on 8.01 as
<viewentries timestamp="20080416T160145,33Z" toplevelentries="4"> ie it puts in a timestamp!
Now, I've no idea why this has happended - are they using different DTDs?
I managed to get round this issue by changing the code from:
viewTotalDocs = parseInt(root.attributes[0].value, 10);
to
viewTotalDocs = parseInt(root.attributes[1].value, 10);
it now works, but I'm not sure if this is the best way to go?
Question is - can you reference the count directly in Javascript without using an array number (then it wouldn't matter what DTD you use)?
I could be barking up the wrong tree completely!
My head hurts !
9. Scott Jenkins04/22/2008 09:46:26 AM
Homepage: http://alpha.jenkinsmd.com
I want to thank the Scott and the community for this wonderful name picker, from which I have learned a great deal, and which has served my organization so well that we started wanting to have new features added to it...
I have reworked it into a single design element, and added several new features including:
- Support for single categories
- Support for multiple return values into differing fields
- Triggering onchange events on the underyling form
I want to give something back to the Notes community which has given me so much, so I have posted this on my (still nacent) blog in the post http://alpha.jenkinsmd.com/archive/2008/04/22/10.aspx
I hope everyone will take a look, help me identify any bugs, and give me feedback for improving it.
---Scott Jenkins
10. Mario Bareither05/09/2008 04:29:56 AM
Have to say - absolutely piece of cake, this piece of code.
Can't remeber having implemented such great functionality in such little time ever.
Great code, great description. Chapeau!
11. Emilio07/02/2008 08:12:25 AM
Homepage: http://www.workflow.com.ar
Hi,
Is there possible to use the AJAX NAB picker like a Dblookup ?
Because I canīt do it.
Thanks
ER
12. Scott Good07/07/2008 08:23:39 AM
Homepage: http://www.scottgood.com
Hi Emilio,
I'm not entirely sure what you mean. Well, more to the point, I can think of several versions of what you mean....
1. Can I use the NAB Picker like a web @Picklist replacement?
This you CAN do. If you read through the comments in the JavaScript you'll find a set of optional URL parameters you can use to point it at different databases and/or views to work like @Picklist.
2 Can I use it to simply return a set of values to other JavaScript code in the same way I use @DbLookup to get values for my Forumula-language code?
This you cannot do, but you can use plain old AJAX to do exactly that. Depending on how much you actually need to retrieve, there are several ways you can do that, ranging from using LotusScript agents to opening Pages which use ComputedText to format JavaScript variables for you.
If you have access to my Lotus Advisor articles online, you can find several approaches there.
Thanks,
Scott
13. Emilio07/11/2008 03:27:20 PM
Homepage: http://www.workflow.com.ar
Scott
Finally it works !
There was an error on the category field in my formula.
Thanks
ER
14. Brett Flagg10/16/2008 01:45:36 PM
I have been looking for somthing like this for some time.
I do have a good command on LotusScript, but not JS and definately not AJAX.
This is great! Thank you so very much....!!
I did find a small bug with this release in the JS Header section of the multiForm. There is a alert near the end that needs to be commented out, otherwise multiple alert popup occur. (probably was put there for debugging)
function getURLParam(strParamName) {
//Get a URL Parameter from the current location.href
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString = "&" + strHref.substr(strHref.indexOf("?") + 1);
// alert(strQueryString)
var aQueryString = strQueryString.split("&");
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
var aParam = aQueryString[iParam].split("=");
strReturn = aParam[1];
break;
}
}
}
you'll see my \\ on the alert(strQueryString)
15. Scott Good10/16/2008 02:50:18 PM
Homepage: http://www.scottgood.com
Whoops!
16. Rakesh04/08/2009 09:01:55 AM
Hi Scott,
This dosen't seem to work on domino 8... do you have any fixes..
Thanks for this.
17. Scott Good04/09/2009 06:28:40 AM
Homepage: http://www.scottgood.com
Doesn't work from a browser or in the Notes client? If it's a browser, which one? There shouldn't be any issues with Domino 8.
18. James White04/15/2009 02:28:16 PM
Homepage: http://www.brazentech.com
I've tried to use it with the supplied AA Ajax NAB Picker Page but it won't work in either IE or Firefox (latest versions of both). Also tried via the Notes Client (8.0.2) and had no luck.
19. Scott Good04/17/2009 03:04:48 PM
Homepage: http://www.scottgood.com
Are you logged in? You have to be logged in for it to work.
20. James White04/20/2009 12:40:18 PM
Homepage: http://www.brazentech.com
Thanks! That was the issue...
21. Raji05/05/2009 03:34:26 AM
Hi,
I copied the required pieces into my application to select single name and it works almost perfect for me. but the multiple selection, I'm getting an error that "&open&returnfield=DeptAdmin"(DeptAdmin is my field name), after I clicked on error few times then the address book displaying. pls help.
22. Aaron Hardin06/03/2009 03:56:55 PM
I'm getting the same thing. error "&open&returnfield=MultipleNames"
Any thoughts? Other than that its great. Thank you.
23. Rami Jundi09/08/2009 03:56:58 PM
Great piece of code. I am hitting a nag though.
I added this to a form for a web application where the user must first authenticate to use. However when this dialog appears after pressing a button it once again prompts the user for their server credentials. Any ideas to avoid this problem?
24. Mike Brown12/08/2009 03:20:51 AM
Homepage: http://www.browniesblog.com
@Scott,
I've tweaked your excellent picker to add some new features, such as:
* Data table resizes when the dialog window does
* Search by last name (as well as first)
I've also re-written a fair bit of the back-end code to use JSON and JQuery. The former gets around the kind of problem reported in comment 8 by Willy. DTDs are already looking a bit 2004, IMHO!!
Of course, there's nothing to stop IBM from changing the JSON layout in later release, but something about the nature of JSON tells me that it's less likely than them tweaking XML again.
Check it out at:
http://www.browniesblog.com/A55CBC/blog.nsf/dx/07122009183645MBRAXK.htm

























