logo

NamePicker v1.5

The other weekend, while Karen was away, I got chance to makes some much-needed changes to the Domino Name Picker widget.

Version 1.5 now features the following improvements:

  • Now uses the most up-to-date "protaculous" libraries — Prototype 1.5 and Scriptaculous 1.7.
  • Set of returned names uses a list instead of a table.
  • Works with either XML or JSON (new config option — OutputFormat, see demo).
  • Code tidy up. e.g: Uses DOM builder methods instead of creating all HTML using verbose strings.
  • Demo points to 40,000+ entries in fakenames.nsf

There's still lots to do on it though. Not least of which are:

  • Filter by first/last name.
  • Port to use with jQuery, YUI, mootools and Dojo.

Maybe my time is better spent working on DExt, which has its own much snazzier name picker widget. One thing's for sure, I've bitten off more than I can chew with the number of in-progress projects I've got going on this site. Must learn to focus my effort on less than 10 things at once and make sure I finish what I've started.

Also need to finish off the Rough Cuts and churn out some other articles. There just aren't enough hours in the day. Especially with a 3 month old son around, demanding attention all the time.

Comments

    • avatar
    • Stuart
    • Tue 6 Mar 2007 06:53 AM

    Get to it you slacker!

  1. Here is another way to do it:

    {Link}

  2. I don't know if it's out of the scope of your namepicker, but if you want to be able to search on the forename, the last name, or "forename, lastname" (or other terms), you can do something like this:

    First column of the view:

    firstname:lastname:lastname+","+firstname

    And "Show multiple values as separate entities" on the column.

    If you have a view with 40k entries, then the view would now have 120k entries. Not sure how this affects the size of the view-index, since the document-count is the same.

    I'm using @DbLookup (@DbLo...;[PartialMatch]); )in the combination with the above for a customer that uses our company for their trading system, and another company for customer registration. When the customer is created in the other system, the data is sendt to us, and a document is created. Using DbL, the customer-document is instantly available to the name-picker.

    Love the effects/icons btw! My namepicker is a lot duller :|

    • avatar
    • Henk
    • Wed 7 Mar 2007 04:37 AM

    You think that your son demands a lot of attention now? Wait until he is 14 months or so, like my daughter. He will be running around, thinking that your computer is the greatest toy in the house. He will be demanding to sit on your lap while you work, hitting all the keys and switching the computer off before you had a chance to save your work. It is great, great fun and I wouldn't miss it for the world, but working at home has become almost impossible. Be prepared! ;-)

    • avatar
    • Jake Howlett
    • Wed 7 Mar 2007 04:44 AM

    I can imagine Henk. I've already started looking at "serviced office" space in the local area...

    • avatar
    • Cristian
    • Mon 12 Mar 2007 05:49 AM

    @Thomas Adrian:

    Hi Thomas,

    is there any English language version of your blog?

    I think it would be very useful to the whole Notes community

  3. Hi Jake

    Thanks. This looks useful in the context of a project here although we use Active Directory for authentication & I think there's a demo in the code bin area of openntf.org relevant to that.

    Mark

    • avatar
    • alexander
    • Wed 14 Mar 2007 10:42 PM

    On a server it is necessary for something to adjust, that all worked? I click on an icon, there is a window of input of a name, enter a name there is a search but results are not present. Base after default has put in names.nsf

    • avatar
    • sduncan
    • Thu 15 Mar 2007 01:29 AM

    alexander

    In the subform NamePicker, change the output format to anything other than "JSON".

    • avatar
    • alexander
    • Thu 15 Mar 2007 07:54 PM

    sdunch, ok change the output format and now search are complete, but result are not present.

    To what format to change? thanks

    • avatar
    • alexander
    • Thu 15 Mar 2007 07:55 PM

    oh... sorry, sduncan!

    • avatar
    • sduncan
    • Fri 16 Mar 2007 11:18 AM

    The code section goes something like

    if ( outputformat == "JSON")

    ' Do it this way

    else

    ' Do it that way

    so if you change it to anything other than JSON it should work.

    Is your namepicker database set to allow anonymous access but your nab not to allow anonymous access? That could cause that issue.

    If not, in the NamePicker.js library look for the line "list_results: function (response){" add

    alert(response.responseText) immediately after it and see what type of response it is getting.

    • avatar
    • alexander
    • Fri 16 Mar 2007 11:54 PM

    sduncan thanks, really problem was in that that anonymous access to base names.nsf has been forbidden.

    what the output format is "JSON"?

  4. @Christian

    I know it must be frustrating finding cool thing on my blog and then discover that everything is written in a language you cannot understand.

    When I starten my blog the intention was to provide a local Swedish blog about Notes as there was to so many english spoken blogs and none in Swedish. As a consultant I do think that a local Notes community ads more value than a global one.

    All I can say is that I am sorry if you are having problems understanding the posts and unfortunately there are no very good webpagetranslators from English to Swedish available.

    If you need ay help translating any of my posts, please send me an email, you can find my contact information at the blog.

    Thanks

    Thomas Adrian

    {Link}

  5. Jake -- great work on the Name Picker!

    We are considering using it on a project. We have it running against a NAB with over 100,000 names and performance is quite impressive!

    We have added some functionality (including sorting, limiting the returned results to ONLY those names starting with the letters you entered and a message if there were no matches) which I will pass along but we are experiencing a problem I hope you can help with.

    We have a form that MUST have "Generate HTML for all fields" checked, and that, sadly, is breaking the whole thing -- the names selected by the user magically disappear upon document save.

    Any way to get around that?

    We've tried quite a few things. The part we are having trouble with is getting "Remove" to work correctly.

    Oddly enough -- I have been able to get it to work in a couple of places on the form but not everywhere. Putting the Notes field inside a DIV with the display set to "none" will SOMETIMES let it work, but there seems to be no telling when it will and won't work... Very strange...

    By the way, we are using a modified version of the "table" format -- we added borders to make it look like a textarea field at the request of our potential users, and added colored row mouseovers for the user's benefit when deleting names from long lists.

    For single name fields, we added the red "X" to the side of the field to give it the same feel as the multi-value fields.

    Thanks in advance, and great job!

    Gary

  6. Think I got it fixed when you need to have "Generate HTML for all fields" checked...

    I'll find a more elegant solution but for now, in the JS function that does the submit, I simply clear the DIV containing the NOTES field(s)...

    Like: document.all.FieldDiv.innerText="";

    Then when the document is saved the Notes field is repopulated with the correct values from the passthru version.

    I'll let you know when I get a better fix working...

    Gary

    • avatar
    • Jake Howlett
    • Thu 29 Mar 2007 04:47 AM

    Gary. I think the problem is the way the browser submits the fields. It's using a trick whereby you can mimic a multi-value field by having lots of sinput <input> fields on the page with the same name. When posted to the server Domino sees them all as values of the same field. However, they have to be submitted one after the other and in order. In your case I think there's a field at the end of the form which has that name and so is submitted out of order. Domino forgets all the previous values it received for that field and takes the *single* value from this latter field.

    Do that make sense? Better probably to delete this last field from the DOM.

    Better still disable the setting!!

  7. Hi Jake,

    Your NamePicker was really usefull for one of our internal web app. I have changed the view to "($users)" to tackle first name/last name filter and then twicked (code attached below) the JS library to avoid duplicate names appearing in the list built in 'Search_Result' div.

    var colValue=entries[i].getElementsByTagName("text").item(NamePicker.settings["column"]-1).firstChild.nodeValue;

    if (list.innerHTML.indexOf(colValue)==-1){ list.appendChild(Builder.node('li',{'onclick':'NamePicker.add(this.innerHTML)'},[colValue]));

    }

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 6 Mar 2007

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content