My first OpenNTF project – Dojo Name Picker
Posted: July 25, 2014 Filed under: Uncategorized | Tags: Dojo, Name Picker, OpenNTF, XPages 8 CommentsA few years ago I created a Name Picker for an XPages project I was working on at the time. The application had several fields that required the selection of users from the address book, but the available options at the time did not fit the bill. In addition, this was the first XPages application for this user base after being firmly entrenched in Notes Client applications for many years. As a result, there was a need to provide some functionality that helped build a bridge from Notes Client to web/XPage applications. Being able to select users from an address book in a similar manner as the Notes Client was a good place to build this bridge.
When I first started building this control, the ExtLib version did not exist yet. Even after ExtLib was released, the environment where this was born did not have ExtLib installed on their servers. In my testing against the ExtLib name picker, this version outperformed it using the 40k entry address book, fakenames.nsf, as well as provides functionality that does not exist in the ExtLib version.
The key features of Dojo Name Picker 1.0 include:
- Ability to choose People, People & Groups, or just Groups.
- Multi Select via a dual column dialog.
- Single Select via a single column dialog.
- Lazy loading of additional entries when scrolling up or down.
- Only creates one dojo dialog widget no matter how many names fields are needed on a form.
- In Firefox and XPiNC the dialog will also display the associated icon for an entry (IE and Chrome do not support option tag background images).
- Ability have the name picker execute a function with the selected value(s) being passed to the function as a parameter.
- Ability to specify a partial refresh target on dialog close.
- No dependency on ExtLib.
- Will work on 8.5.3 and above (will probably work on 8.5.2 but this release has not been tested on that version).
You can test the name picker for yourself via a live demo here.
You can view this project on OpenNTF here.
Future Enhancements
While I feel this is a good, solid release, there are some improvements I would like to make:
- Bootstrap version (coming soon!) .
- Improved caching.
- Ability to return selected items as a JSON string.
- Ability to define additional fields to pull from the NAB
- Support multiple address books
Thanks for checking it out!
Hi and thank you for sharing this component.
Have you work on the bootstrap version and will you share it ?
Regards, Olivier
LikeLike
Hi Olivier –
The Bootstrap version is essentially done, I just need to get the demo setup and a blog post published. Hopefully this week.
LikeLiked by 1 person
Hi
I am looking for ability to define additional fields to pull from the NAB. Like, when I select any person name. It should pull the other details(employee id, department, country from NAB) along with name.
Regards
Ajay Mali
LikeLike
Michael, I completed the above request by making changes in SSJS and ccNamePickerLoader control and it working fine.
LikeLike
Great! Glad to hear that. Yes, you can adjust the ssjs to pull additional fields from the nab. Hopefully a future release will make that a configurable option.
LikeLike
Hi Michael,
I have used your code for name picker to select the name from notes address book (name.nsf). It is working fine with all condition. However, when I marked any of the form field as required field. Dojo Name picker doesn’t work. Although, I used for single picker, It shows me the multi picker without any values.
Regards
Ajay Mali
LikeLike
Ajay, since validation is failing, the code in the name picker is not executing. This is not necessarily a fault of the name picker. If you had any button that had ssjs code, it would not execute due to validation failing. With that being said, I will take a look at enabling the skip validation option to see if that solves the problem.
LikeLike
Hi Michael,
Nice to see your quick reply. Just to add into the issue. If I download sample database from openntf and in demo XPage, make “Multiple Names” field as required field with validation message and disabledclientsidevalidation equal to true. It stop working.
In my form design, I have many field and need to validate before submitting. To get the all error message at top of the page, I used Display Errors control with disabledclientsidevalidation equal to true. Please let me know, if you are able to produce the error.
Thanks
Regards,
Ajay Mali
LikeLike