Manage Learn to apply best practices and optimize your operations.

Select Multiple Values On Web

If you want to choose a multiple values from a list on the web, you have to
press down Ctrl button and then select choices with a mouse. It is very
inconvenient for users (if he/she forgot to press Ctrl he/she lose all
selections made before), specially if you have very large list.

My solution is : I filled one field with all posible choices and in the other
one are only the choices user selected. User can transfer desired choices from
field one to another just with double-click (and vice-versa). My solution looks
like Address window in Domino Mail(R5) db, but you can use any Notes function
to fill Entry List field with choices and there is no need to reload. Just do
as I described bellow and enjoy....
I upgraded (from form wAddress in Mail db) and add some JS functions to make
selection much more easier. I have special form (wSelect) which is open from
document (like wAddress in Memo) and where I make my choice. On form wSelect
are fields:

EntryList - standard, editable Notes "DialogList" field with propertie "Allow
Multiple Choices" checked and @DbColumn() - could be any function you want -
function in choices window. On event onDblClick I call JS function
"AddClick(fieldContacts)"

tmpContacts - standard, editable, Notes "DialogList" field with propertie
"Allow Multiple Choices" checked and for Choices just a line like ----------
(so I choose "Enter choices (one per line)"). On event onDblClick I call JS
functions "RemoveClick(tmpContacts)" and "fieldContactsRef.value =
selectToString(fieldContacts)".

tmpContactsRef - hidden, standard, editable, Notes Text field with propertie
"Allow Multiple Choices" checked.

On the form wSelect are also some hotspot buttons like Remove, Remove all -
intendent for removing values from tmpContacts field, OK button - onClick I
call JS function OKClick(), Cancel button - onClick called with JS function
CancelClick().

Following code should reside on load event of the wSelect form:

var OrigValue;

openerDoc = window.opener.document.forms[0];
OrigValue = openerDoc.Users.value; //Users - the field on my document (not on
wSelect form) for which I want to
make

//selection
fieldContacts = document.forms[0].tmpContacts;
fieldContactsRef = document.forms[0].tmpContactsRef;
fieldEntryList = document.forms[0].EntryList;


if ((window.location.href.indexOf("Seq")) ==-1)
{
RemoveAllClick();
fieldContactsRef.value = OrigValue;
stringToSelect(OrigValue,fieldContacts);
}
else { //in case of reload (there is no need to reload but mybe you'll
needed foe some other things)
RemoveAllClick();
stringToSelect(fieldContactsRef.value,fieldContacts)
}

In JSHeader of form wSelect you should put next JS functions:

var myDoc;
var openerDoc;
var fieldContacts;
var fieldEntryList;
var fieldContactsRef;

//function OKClick return selected values back to original document
function OKClick()
{
openerDoc.Users.value = selectToString(fieldContacts);
self.close();
}
function CancelClick()
{

self.close()
}

function AddClick(field)
{
if(fieldEntryList.selectedIndex != -1)
{
for (var i=0; i < fieldEntryList.options.length; ++i)
{
if (fieldEntryList.options[i].selected)
{
var selection =
fieldEntryList.options[i].text;
field.options[field.options.length] = new Option(selection);
}
}
}
fieldEntryList.selectedIndex = -1;
sortSelect(field,field.options.length); // not necesary - if you want to sort
and unique selected values
fieldContactsRef.value=selectToString(field);
}

function substring2(string, start, length) {
return string.substring(start,start+length);
}
function RemoveClick(field)
{
if (field.length != 0){
if (field.selectedIndex != -1)
{
for(var i=0;i&LTfield.options.length ; ++i)
{
if (field.options[i].selected)
{
field.options[i] = null;
--i;
}
}
}
}
}

function RemoveAllClick()
{
fieldContacts.options.length=0;
}


function trim(str)
{
for(var i = 0 ; i&LTstr.length && str.charAt(i)==" " ; i++ ) ;
return str.substring(i,str.length);
}


function stringToSelect(str,field)
{
var div = ","

for(var beg=0 ; beg < str.length ; beg = end+div.length)
{
if(-1 == (end = str.indexOf(div,beg))) end = str.length

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close