In the Notes client, you often have a series of comboboxes where the
value in one, determines the list of choices in the next, a common
example being "Main Category", "Sub Category1", "Sub Category 2".
When doing this on the Web, using the built-in "refresh fields on
keyword change etc" feature, it works, but can cause the screen to
jump around as all the fields are refreshed.
I had a user who didn't like this, so this is the solution I came up
with that writes comboboxes dynamically, by looking at a hidden
field containing the data - a sort of pseudo-DBLookup in
JavaScript.....
Code
An alternative to using "refresh fields on keyword change" and
"refresh choices on document refresh" involves 4 parts
1) A Lookup view, that contains the values in a single column,
using a predefined separator - I use the pipe symbol |
2) A hidden lookup field on the form that does a dbcolumn on the above view
3) Some JavaScript to process the hidden field above
4) A field that contains the lookup value and a hotspot on the field
that triggers the above JavaScript
As follows
1) Create a view - for example, I called in "LookupStaffDivisions",
and it should have only one column, which contains multiple values
separated by a common separ
To continue reading for free, register below or login
To read more you must become a member of SearchDomino.com
');
// -->

ator. In my case I used the pipe symbol
'|' which is also in the JavaScript code. An e.g. of the column
contents is:
HR|Bob Jones
HR|Mike Smith
Admin|Sarah Joyce
Admin|Bill Clinton
2) Create a hidden field on the form that looks this up e.g.
<input type="hidden" name="lookupSomeValue"
value="[SOMECOMPUTEDFIELD]" >
Everything in the line above is passthru HTML. The
[SOMECOMPUTEDFIELD] is replaced with a field that is
computed when composed and contains a dbcolumn on some view. A
sample formula for the field is below:
(Note the space " " at the end of the value of t1 - this is needed
due to the counting starting at 0 in JavaScript)
Sample field value:
4) The code for the JavaScript hotspot, which causes the contents
of a combobox to be changed dynamically.
form=document.forms[0];
key=form.Division.options[form.Division.selectedIndex].text;
getLookupList( key, form.StaffList, form.lookupSomeValue.value)
In the above code, Division is the name of the first combobox, which
when selected changes the contents of the 2nd combobox which is
called StaffList, providing a quick way of doing a dblookup without
the issues of the screen jumping around when a refresh occurs.