Domino Code Fragment

Code Name*
Convert multi-value items to JavaScript arrays
Date*
11/26/97
Source (or email address if you prefer)*
Jamie Magee
IP address:.13.59.130.130
Description*
Parse the values stored within a Notes multi-value field and place them into individual elements within a JavaScript array.
Type*
JavaScript
Categories*
List Processing/Sorting, User Interface (Web)
Implementation:
Modify constants
Required Client:
Server:
Limitations:
NS3+, MSIE4+ only
Comments:
Files/Graphics attachments (if applicable): Code:
Write JavaScript code on a Notes form, with a Notes computed-for-display multi-value field embedded within the lines of the javaScript such that the JavaScript sees the Notes formula result as JavaScript code.  Don't forget to mark it all as pass-thru HTML.

In the Notes field, use a newline separator, and write the following formula:

"s = s+'" + NotesListValue + "~';"


On the form, place the following JavaScript:

var s = "";
>>>>>> NOTES_FIELD_GOES_HERE <<<<<<<
s = s.substring(1, s.length);
var myArray = s.split("~");   //splits out the string into array values NS3+, MSIE4+ only


Results in JavaScript that looks like this...