Keyword Refresh R2.0

This code example/template shows how you can use JavaScript to update the choices in a Keyword list that are dependent in a choice made in another multi-choice field.

This problem is one that is often referred to in many on-line discussions areas and yet has never had a decent workaround (in my eyes anyway). The fixes that have been suggested almost always involve the page being submitted to the server in order for it to reprocess the field values.

Version 2 of this database introduces XML and a new look. The database now only works in the browser.


The XML techniques used make use of XML Data Islands and the MS XML Parser. Using these Data Islands means that the we can overcome the 64KB limitation of using @DBLookups. Version 1 was limited by the number of options that could be returned for each drop-down.

Using the same principles we can extend this model so that when one select field is changed we can update numerous amounts of data in many different fields. Keep your eyes peeled for Version 2.x ...


    • avatar
    • laurent bettembourg
    • Wed 21 Mar 2001

    problems with accented characters

    jsrefresh example can cause problems with accented characters. I'm using a 4.62a client with 4.6.1d server and all é,à... are replaced by eacute; aagrave;... As a matter of fact, all the generated javascript arrays are wrong and the refreshing list values are wrong too. A solution is to use uppercase characters.

    I found two technotes in the Lotus Notes Knowledge Base about similar problems. Here they are :

    Accented Characters Do Not Display Properly Using JavaScript & Microsoft Internet Explorer 3.02


    When using accented characters and a JavaScript form validation function, an display error occurs in the alert() prompt. Instead of the accented character being displayed in the alert(), the character is converted to a descriptive code (example: é, instead of an accented E). For example:

    1. JavaScript files can be stored in a Notes document and retrieved through a dblookup into the header of the HTML form. 2. Initially, the French characters, for example é, were entered directly into the JavaScript code. But when the alert message appeared, the é was converted to é. 3. If you switch to the octal value, and replaced the é with \351, this works for all browsers except Microsoft Internet Explorer 3.02.


    To workaround this issue, use a straight HTML file where you type in the code and let the server convert it for you.

    Accented Characters in META Tags and in JavaScript Converted to HTML Entities


    When you use accented characters in a META tag in a Notes document ($$HTMLHead), you find that the HTTP task converts them into a 7-bit encoding. For example, you use the following tag:

    <META NAME="GENERATOR" CONTENT="accentued char : é">

    This text will be converted as follows:

    <META NAME="GENERATOR" CONTENT="accentued char : &eacute;">

    The Domino HTTP server does not support accented characters (8-bit encoding); however, this tag works on other HTTP servers.


    This issue was reported to Lotus Quality Engineering and has been addressed in Domino 4.6.2.

    Excerpt from the Lotus Notes and Lotus Domino Release 4.6.2 QMR fix list:

    SPR# LEZ3VZEAE - Prevent the conversion of accented characters in META tags and in JavaScript to HTML entities by providing US-ASCII as a character set choice for the HTTP server in the Server document of the Address Book. [4.6.2]

  1. Too many choices in Array??

    I had a go at this function, and it works beautifully -- until, that is, I have too many choices in one of the arrays. There appears to be a "cut off"...

    The error message I receive is (in the js console) "missing ] after element list" and "keywordArray has no properties". Looks to me like the browser is cutting off if the array is too long. Is this the case?

    I'm probably overlooking something in my haste. If that is indeed the case, I apologize. Any insight you might offer would be great. Thanks so much...love the site.

  2. How to replace categorised views?

    Hi Jake,

    That's a great little example and I tried to use it for the specific task at hand and got stuck.. (I'm new to XML but possibilities are exciting so I don't mid learning a bit)

    There's a categorised view with each document having a multi-value field - team members - and categories are by 'business area' which is another field on that lookup document. Each category is used as a 'list of choices' for a drop-down list and when a user selects an area, the whole page gets reloaded in order to fetch a new list of choices for 'select a team member' field. How can this be done via XML? I tried creating another model document with the same make but that didn't work.

    Thanks, Andrei

    • avatar
    • Matt
    • Mon 4 Mar 2002

    Great tip but ...

    Hi Jake this is great tip

    i used same trick in my products site & everthing worked fine until today when keywords are changed includes a word with ' (ex. X'max gifts or X'mas tree) & will results in javascript error & will not work as expected

    it is something to do with JavaScriptArrays field & we need to find better way tolist keywordArray

      • avatar
      • Matt
      • Tue 5 Mar 2002


      i found solution by making minor changes to JS refresh 2.0 db by adding following code in 3rd column of Models view as

      temp := @ReplaceSubstring( kModel; "\'" ; "\\\'" );

      "\'"+@Implode(temp;"\', \'")+"\'"

      this makes JS arrays able to handle quotes in the keywords fields

  3. Tip: using array's and javascript..

    The site:


    contains the keyword functionality using Javascript and array's for the possible choices (all combinations need to be known up front). This way no submit is required after each keyword selection.

    1. ... that volkswagen URL no longer valid Jan 2003..


      doesn't work any more... just FYI to anyone wanting to check it out in the future.

  4. Fantastic - great also for a web based NAB lookup

    Thanks for this Jake, looked very good. I've just been playing around with it to code a web based name lookup - works a treat!

  5. Fill array when subcategories on seperate docs?


    Great tip. However what if there is a seperate document for each subcategory? i.e. The document contains the main category name and subcategory name. Thus I can't have a column in the view listing all subcategories for a specific category. Is there anyway to populate the javascript arrays using a view?

    Regards Michael

    1. Re: Fill array when subcategories on seperate docs?

      Look at the XML method used. You could easily do it with a few tweaks of that method.

      Jake -codestore

      Show the rest of this thread

  6. Help?

    Dear anyone,

    I am trying to adapt this code to cover two updated fields from one input using the XML version. This meant creating two types of child node in the XML under the parent. However, the updateCategories() function is designed to only count the number of chilod nodes regardless of type. Does anyone know how to specify the length (Number) of a specific type of child node so I can distinguish between the two?



    • avatar
    • Marlo
    • Wed 8 Jan 2003

    Keyword Refresh 2.0

    When I try to implement the JS version, I receive an error that PropertyName field is null or not an object.

    PropertyName field is dialog box, used as the primary lookup to get the next related object.

    Thanks for help

    • avatar
    • marlo
    • Thu 9 Jan 2003

    Does not recognize keywordArray

    I can not get the js version to work either. I am using v 5.0.11

      • avatar
      • marlo
      • Thu 9 Jan 2003

      Re: Does not recognize keywordArray

      It did not recognize the array because their was apostraphe characters in the city names.

    • avatar
    • Vic
    • Mon 31 May 2004

    Any idea how to cross reference for the drop down

    any idea how to cross reference to other database for drop down list and also for the on change event?

  7. 3 Keywords Refresh

    Is it possible to refresh 3 fields in XML, for example, Area / Country / City

    Would you have any idea ?


  8. great idea, with a twist

    The view function didn't work for me to load the xml but I called an agent that printed the xml and worked liked a charm. I have three dialog boxes that were all dependant on each other. They switch options like a charm.

    Brillant solution!

  9. What about # of days between dates?

    I have a similar situation with two date fields and I was wondering if you could give me some advice.


    I need to calculate the days(Total Days) between "Date Reported" and "Date Solved", every time that the user changes the values of either date, the field "Total Days" needs to get updated.

  10. js error - document has has no properties

    XML Newbie here: Attempting to use this in my database. I'm VERY close to success. The data for the drop down is Large. On the web, I get nothing. but I see an error in NOTES.. Error: ToObjectError: document.all has no properties. I have only changed the formula for the data in the dialog lists. I have kept everything else the same. Any suggestions.

    1. Re: js error - document has has no properties

      This thread got me thinking (very scary, that) and I'm curious as to what techniques are popular for resolving a similar issue - dependancy hide/when values. For instance, if I have a field that is hidden based on the value of another field (which, for me at least tends to be a keyword type field) or simply hidden if another field is blank, the form must be refreshed in the browser window for the new field to show up. Are there other techniques that can avoid having to refresh on keyword change or use a hotspot to refresh the form which would make the new fields visible? I hope all that made sense.

      Show the rest of this thread

    2. Re: js error - document has has no properties

      it is working in internet exploral,

      but this validation is not working in netscape.

      what is syntax alternative for netscape:


      mycode is:

      <html> <head> <title> CLOE </title> <script language="JavaScript">

      function setVisibility(id, visibility) { document.all[id].style.display = visibility; } </script> </head>

      <body bgcolor="gray"> <form name="cloe" action="aa.html" > <center><br><br>

      <table width="50%"> <tr> <td><b> Full Name<b> </td> <td><input type="text" name="fname" value="" size="15" maxlength="15"></td> </tr> <tr> <td><b>Gender<b> </td>

      <td><input type="radio" name="gender" value="Male">Male <input type="radio" name="gender" value="Female">Female </td> </tr> <tr> <td><b>Password<b> </td> <td><input type="text" name="Password" value="" size="15" maxlength="15"></td> </tr> <tr>

      <td><b>Re-Enter Password <b> </td> <td><input type="text" name="repasswordname" value="" size="15" maxlength="15"></td> </tr> <tr> <td><b>Usercategory <b> </td> <td><select name="uc"> <option>Option 1</option>

      <option>Option 2</option> <option>Option 3</option> </select></td> </tr> </table><br> <table width="53%"> <tr> <td><b>Address</b></td> <td> <input type="radio" name="realtor" value="Yes" onClick="setVisibility('realtor1', 'inline');" selected>Yes&nbsp;

      <input type="radio" name="realtor" value="No" onClick="setVisibility('realtor1', 'none');" >No </td> </tr> </table> </div>

      <div id="realtor1" style="display:none"> <table width="53%"> <tr><td><b> Company Name<b> </td> <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td>

      </tr> <tr><td><b> Street<b> </td> <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td> </tr> <tr><td><b> State<b> </td> <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td>


      <tr><td><b> Mobile <b> </td> <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td> </tr>

      <tr><td><b> Fax <b> </td>

      <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td> </tr> <tr><td><b> Pin/Zipcode <b> </td> <td><input type="text" name="prfname" value="" size="15" maxlength="15"></td> </tr> </table> </div>


      </form> </body> </html>

  11. Other Browsers Types

    Can anyone give me some help on making the script compliant with other browsers such as Firefox and Safari

      • avatar
      • Jake Howlett
      • Tue 20 Sep 2005

      Re: Other Browsers Types

      Simon. It might be better to use AJAX if you want to get it to work in all/more browsers.

      Maybe I should update it ... ?


  12. Stop browser jump on Refresh fields keyword change

    Thought I would add this here... cause I came here looking for solution to this problem. Hope it helps others.

    Prob in notes when you do a web refresh - ie to calculate the value of a field based on other conditions the page will jump - either to the top of the page (bad) or bring the field you are working on to the top (only slightly better than the other option)

    so... how to fix


    instead of using the field property "Refresh fields on keyword change" you use an onclick or an onchange event and use some code like


    this will refresh the page but you still have a problem with the jump but at least you control the code not domino then

    use these javascript functions to capture the current scroll position

    function storePos(){ document.cookie = "win_"+window.name+"="+document.body.scrollTop; } function lastPos(){ cVal = document.cookie.split("win_"+window.name+"="); if(cVal.length==2){ window.scrollTo(0,parseInt(cVal[1])); } }

    put this in the JSheader or wherever you normally put your JS

    lastly you need to place

    <body onLoad="lastPos()" onScroll="storePos()">

    in the body note that we have onLoad but no onScroll in domino so I just whack it in in pass-through HTML and domino copes fine

    so what happens is on the field being clicked it gets refreshed... and the current postion is always tracked so the refresh leaves you at the right place

    cheers luc

    1. Re: Stop browser jump on Refresh fields keyword change

      That solved my problem. Thank you Luc!!!!

      • avatar
      • DB
      • Sat 5 Dec 2009

      Thanks a lot, Luc. This worked in both IE 7.0 and Mozilla Firefox 3.5.5. I put the lastPos() in the onLoad event of the form. I added the functions lastPos() and storePos() in the JS Header of the form and the onScroll=storePos in the Body tag of the Domino Form in Passthru HTML.

Your Comments


Navigate other articles in the category "Forms"

« Previous Article Next Article »
Form Validator R2.0   Creating response documents in the browser

About This Article

Author: Jake Howlett
Category: Forms
Keywords: Keyword; JavaScript; Refresh; Dialog; XML;


jsrefres12.zip (36 Kbytes)
jsrefres20.zip (39 Kbytes)


Print Friendly

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 »