Posted in XPages

How to Append and Prefend using Javascript in xPages

create a function like this on your page

function addToList(thisdoc:NotesXspDocument, fieldname:string, newVal:string, atype:string) {
var newArr = new Array(thisdoc.getItemValue(fieldname));
switch (atype) {

case ‘append’:
newArr.push(newVal);
break
case ‘prepend’:
newArr.unshift(newVal);
break
}
thisdoc.replaceItemValue(fieldname, newArr);
return true;
}

And to use the function:

addToList(document, “foo”, “blah”, “append”)

Advertisements

Author:

Lotus Notes Consultant @ 77GSI. contact me thru ym: glennliwanag

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s