Hi,

sometimes the seemingly easy things just don't work as expected.
I cant get my head around how to create a download for a list of attributes as a csv file.

This is the code I think might work on a normal webpage:

var blobObject = null;

function createDownloadLink(anchorSelector, str, fileName){

if(window.navigator.msSaveOrOpenBlob) {
var fileData = [str];
blobObject = new Blob(fileData);
$(anchorSelector).click(function(){
window.navigator.msSaveOrOpenBlob(blobObject, fileName);
});
} else {
var url = "data:text/plain;charset=utf-8," + encodeURIComponent(str);
$(anchorSelector).attr("href", url);
}
}

$(function () {
var str = result;
createDownloadLink("#export",str,"export.txt");
});
What i do is first I hava a dn PickList to display a number of groups.
When one is selected I read the members and display a table in an html string field.
That works just fine.

I would like to make it possible to save that list as a file and stubled upon the code above but cant understand what part goes where.
I assume I need another html string that will display the download link.
I tried to add the function crateDownloadLink as an inlinescript and that might work but I dont know how to call it properly from the html field.
I also need to get the values from my list field called "Content" into that variable str instead of result as it says in the code right now.

Thanks for any input