|
OK. Figured it out.
Created a new 'CASE' for SPDisplayRelatedInfo. Note: This is hardcoded to look for a multiline textbox named "Notes"
// append to Notes field
case "notes":
var outString = "Please provide supporting information:"; // This does display on page load
// Get relevant Notes from relatedlist
for (i=0; i < opt.relatedColumns.length; i++) {
$(xData.responseXML).find("[nodeName=z:row]").each(function() {
// outString += "* " + relatedColumnsXML[i].attr("DisplayName") + " *";
outString += "* " + showColumn(relatedColumnsXML[i], $(this).attr("ows_" + opt.relatedColumns[i]), opt) + " *";
});
}
// alert(outString); Debugging
setTextFromFieldName("Notes", "" + outString + "");
break;
// end of new 'CASE'
At the end of the jquery.SPServices-0.4.6.js, I have added the following functions:
// Find the Notes field
function setTextFromFieldName(fieldName, value) {
if (value == undefined) return;
// alert(value);
var theTextBox = getTagFromIdentifierAndTitle("textarea","",fieldName);theTextBox.value=value
}
function getTagFromIdentifierAndTitle(tagName, identifier, title) {
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i=0; i < tags.length; i++) {
var tempString = tags[i].id;
if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
return tags[i];
}
}
return null;
}
// End of new functions
Here's the actual call from the Form page:
$().SPServices.SPDisplayRelatedInfo({
columnName: "",
relatedList: "",
relatedListColumn: "",
relatedColumns: [""],
displayFormat: "notes", // new case
});
Hope this helps.
|