Home > Domino Tips > Developer > HTML > Using names.nsf undocumented features
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

HTML

Using names.nsf undocumented features


Christian Cloutier
08.01.2004
Rating: -4.19- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

Have you ever wanted to use the "Select Names" Web dialog, as seen in names.nsf and webadmin.nsf in R6.x, in your own R6 Web applications? This tip shows you how to do it.

  1. Add the following code to the form "HTML Head Content" section:
    _tDb := "names.nsf";
    _is6 := @TextToNumber
    (@Version) < 171;
    
    "<meta http-equiv='expires' 
    content='0'>
    <script>
            var sElementType = 
    'document';
     var sDocType = 'group';
     var sDBFileName = '" + _tDb + "'; 
     var sDocUNID = '" + 
    @Text(@DocumentUniqueID) + "';
     var sDefaultView = 'Groups';
     var sWebDbName = '/" + _tDb + "/';
     var isDom6  = " + 
    @If(_is6 ; "true"; "false") + ";
    </script>" +
    @If(_is6;
     "<script src='/" + _tDb + 
    "/WebJSTools?
    OpenJavaScriptLibrary'></script>
      <script src='/" + _tDb + 
    "/WebJSNavigationTools?
    OpenJavaScriptLibrary'></script>";
     "<script src='/" + _tDb +
     "/WebJSNavigationTools5?
    OpenPage'></script>"
    )

  2. Create a field (preferably of Names type) on your form to receive the entries selected by the user in the dialog.

  3. Add computed text to the right of the field created in step 2 with the following value:
    REM { Use Web Address 
    dialog from names.nsf };
    
    @If(@ClientType = "Notes"
     | !@IsDocBeingEdited; @Return(""); "");
    
    _tLabelOneItem := "name";
    
    REM {DNT};
    _tFieldName := "CREditAccess_T";
    _tDb     := "names.nsf";
    
    "<a onclick="
    
     initTools();
    
     var hDlg = window.hDlgAddrMulti;
    
     hDlg.sMsgOneEntry = '"+ 
    _tLabelOneItem +"';
     hDlg.hDestField = 
    document.forms[0]." + _tFieldName + ";
     hDlg.dlOpen();
    
     return false;
    
    " href=""><img src="/" + 
    _tDb + "/btnPicker.gif?OpenImageResource" 
    width="15" height="11" border="0"
     alt=""></a>"

  4. Change the "_tFieldName" variable in the code above to the name of the field you created in step 2. This field will receive entries selected in the Web dialog.

Enjoy!

MEMBER FEEDBACK TO THIS TIP

Good job. I love when somebody finds a simple but effective solution that can help a lot. It helps in creating a more user-friendly application, and even helps developers to look for a way how to do it next time.

—Petr H

******************************************

Things to bear in mind for this tip are as follows:

  • Ensure that the Maximum Internet Access on the ACL for names.nsf is set to Editor (not Reader as mine was – is this the default?).
  • Ensure the receiving field on the form is Editable (not Computed – sort of logical I guess but I was expected the value to be set using JavaScript).
  • Change the "<177" to ">177" to correctly identify Notes version 6.
  • Change the double quote surrounding the onClick event on the <a> to backslash double quote or else the compiler complains. You may also have to change all double quotes within that event to single quotes.

When this has been done, it works (a bit slowly in populating the list, but it saves me coding!). I haven't fully tested the multiple selection of names (they won't fit into a standard field, of course), and I need to see how they end up in a stored document -- but it's a start!

Also, if you change the agent "wReadAddressData" in the NAB in the initialize section thus:

'add entry to the list
Set nmUser = New NotesName(Cstr(vweDir.ColumnValues(3))) 
'RSB: Was column 2 (not 3), which gave the e-mail address. What we need is the Notes address, column 3.

You can get it to return Notes Names rather than e-mail addresses. You'll probably want to either change the template or clone, and amend the code to call another agent with this change, rather than change the original -- but you get the drift….

—Ralph B.

******************************************

This tip is very nice. But the computed text's value has a problem and to correct it is not nice. Here is the right one:


REM { Use Web Address dialog 
from names.nsf }; 

@If(@ClientType = "Notes" 
| !@IsDocBeingEdited; @Return(""); ""); 

_tLabelOneItem := "name"; 

REM {DNT}; 
_tFieldName := "CREditAccess_T"; 
_tDb     := "names.nsf"; 

"<a onclick=\" 

 initTools(); 

 var hDlg = window.hDlgAddrMulti; 

 hDlg.sMsgOneEntry = '"+ 
_tLabelOneItem +"'; 
 hDlg.hDestField = 
document.forms[0]." + _tFieldName + "; 
 hDlg.dlOpen(); 

 return false; 

\" href=\"\"><img src=\"/" + 
_tDb + "/btnPicker.gif?
OpenImageResource\" 
width=\"15\" height=\"11\" 
border=\"0\" alt=\"\"></a>"

I tried this, and it works well.

—Oya K.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Christian Cloutier. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
HTML
Create a dynamic fluid image gallery with Lotus Notes views
Write HTML and JavaScript in Notes view rows and columns on the Web
Open Lotus Notes documents in Microsoft Word without coding
Trap an attachment path via the Domino file upload control field
A bevy of Notes/Domino development tips
Styling Lotus Domino Web fields
How to convert Microsoft Word or Microsoft Excel documents to HTML
An easier way to view multiple columns on the Web
How to print a form in landscape format automatically
Tip contest winner: Hide view column while being able to sort it

HTML for Lotus Notes Domino
Create a dynamic fluid image gallery with Lotus Notes views
Write HTML and JavaScript in Notes view rows and columns on the Web
Open Lotus Notes documents in Microsoft Word without coding
Top 10 Lotus Notes/Domino coding and development tips of 2008
Trap an attachment path via the Domino file upload control field
Mimic Lotus Notes Domino application functionality on the Web
Top 10 Lotus Notes Domino programming and development tips of 2007
Creating a link on an HTML page to a Microsoft Word attachment in a Lotus Notes database
A bevy of Notes/Domino development tips
Top 10 Notes/Domino developer tips of 2006

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts