PermaLinkAn improved AJAX NAB picker02:40:13 PM
Written By : Scott Good
NabPickerSmall.gif

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!

Comments :v

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




Enter Comments^


Email addresses provided are not made available on this site.





You can use UUB Code in your posts.

[b]bold[/b]  [i]italic[/i]  [u]underline[/u]  [s]strikethrough[/s]

URL's will be automatically converted to Links


:-) :cry: :-\ :huh: ;-) :cool: :grin: :emb: :laugh: :-p :lips: :-( :rolleyes: :-o :-D :angry: :-x
bold italic underline Strikethrough





Remember me    

Disclaimer & Copyright
Monthly Archive
Contact me...
Racing sponsors and such...

Thank you sponsors!

GABlogLogo.jpg

GOODAero

GOODAero specializes in building aerodynamic products for racing cars. Our first product, the GOODAero Raptor wing is available at a surprisingly reasonable price (under a grand) for a full carbon, full-sized, racing wing. Check it out.


Infinite Fiberworks Co, a great source for high-quality Porsche fiberglass parts

Infinite Fiberworks Co.

If you are looking for fiberglass for Porsches, IFC is the place to go. I have used parts from most of the major suppliers and IFC's are easily the highest quality and the most reasonably-priced. Contact Mike at Infinite Fiberworks for more information.

Located in Racine, OH (so far Southeast they're almost in West Virginia), IFC's goal is to be The Best. Give 'em a try.


Bent or ugly wheels? Call Wheel Medic!

Wheel Medic & The Round House

Whether you need to repair, repaint, refinish or just replace your wheels, the guys at Wheel Medic/Round House can get you back on the road in no time!

Wheel Medic, Inc is a family-owned company which specializes in the repair and restoration of aluminum wheels.

The Round House was founded to service Wheel Medic's clients looking for more than just repair work...from custom wheel colors to high-end wheel applications and body kits, the Round House is there to serve the discriminating automotive enthusiast.


Used Porsche parts, great prices!

A Part Above

Looking for used parts for 944s, 924s, 968s or other late-model water-cooled Porsches? Contact John at A Part Above.

Located in Strongsville, OH (20 miles south of Cleveland) their goal is to provide top quality parts and services. I can tell you, John is great to work with and the prices? Very hard to beat.


SMRT Motorsports wants you!

SMRT (that's short for Skid Mark Racing Team), a very-

loosely organized band of fun-loving friends who enjoy auto racing (heck, cars in general), and the occasional adult beverage, wants you to be a part of our team.

Go here to find cool T-shirts, sweatshirts, caps and mugs with the SMRT team logo.

The BlogRoll
Lotus Domino ND6 RSS News Feed RSS Comments Feed Geo URL RSS Validator Blog Admin Lotus Geek Open Notes Picture Database OpenNTF BlogSphere
Calendar
February 2012
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
By Category
What I do for a living


I am the President of Teamwork Solutions a long-time Lotus, now IBM, Premier Partner.

With offices in Columbus and Cincinnati, Ohio, we specialize in custom application development for IBM Lotus Notes, Domino, and related technologies. Our software product, ProcessIt! (see below), is quite possibly the world's best, most powerful and easiest-to-use workflow tool for Notes and the web.

Our clients are some of the world's largest corporations along with others that aren't so big.

We do excellent work, quickly, and often on a fixed-fee basis. We'd love to talk to you about your next project.




I am a Contributing Author to Lotus Advisor Magazine, with more than 40 articles under my belt.

I've written how-to series (serieses?) on LotusScript, JavaScript, Cascading Style Sheets (CSS), and now, AJAX (Asynchronous JavaScript and XML), as well as a bit on miscellaneous web development topics.


TheView.jpg

I also write for The View as of the July/August issue where I showed how to take an ugly Notes applications and make it beautiful with just a few minutes' (careful) work.



I am the chief architect and one of two primary developers for what many consider the best all-around workflow tool for Notes/Domino, anywhere, regardless of price.

It's called ProcessIt!, and you can read all about it at www.notesworkflow.com but the bottom line is this: ProcessIt! is fast and easy to learn, extremely powerful, and can be used by mortals. Even--dare I say it?--common users.

You can spend a lot more on a workflow tool but you won't be able to do a lot more for all the extra money.

Don't believe me? Download and try it for free for 60 days.



GTSLogoSm.gif
Copyright Porsche and NASA...not me!

I race a Porsche 944 S2 in National Auto Sport Assocation events and am the 2008 National Champion in NASA's GTS2 class.

Blame this event, a few years ago, for starting that particular money drain all over again.

In support of my habit, I am the NASA Great Lakes Region's GTS (German Touring Series) Director.

I'm also a Nationally-Certified Instructor for the Porsche Club of America and am in charge of classroom sessions for the Mid-Ohio region when we are doing high performance driving events.

In a prior racing life, I was the Midwestern Regional Formula Atlantic Champion and, in 1991, the Ohio Vally Region of SCCA's Regional Driver of the Year (but that, alas, went away when my credit cards let go of the rope!).




I'm writing a book...or at least trying to.

It's murder mystery in which, not too surprisingly, the main character runs a small software company and races cars for fun. Oh yeah, and lives near where I do.

Just where do they come up with these crazy ideas?

Facebook