Home › Forums › Comment box for SharePoint › Multiple instances
- This topic has 1 reply, 2 voices, and was last updated 8 years, 9 months ago by Alexander Bautz.
-
AuthorPosts
-
-
March 1, 2016 at 19:41 #10510
Hi, I’m trying to get multiple instances to work without luck!
The moment I add a second Arg and call for spjs.cBox.init(cBoxArg2) The comments button stop working (on both instances), and I get error in the Console:Uncaught TypeError: Cannot read property ‘url’ of undefinedspjs.cBox.saveComment @ VM85137:1
This is my CEWP:
<!– Placeholder for the comments – this must correspond with the “placeholderID” in the variable “cBoxArg” below –>
<div id=”commentBoxInstanse_1″ style=”padding-left:10%;”></div>
<div id=”commentBoxInstanse_2″ style=”padding-left:10%;”></div><!– Style sheet – including fontawesome –>
<link href=”https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css” rel=”stylesheet”>
<link rel=”stylesheet” href=”/sites/SiteAssets/SitePages/Scripts/Comments/spjs-cBox.css”><!– Scripts –>
<script type=”text/javascript” src=”https://cdn.tinymce.com/4.3/tinymce.js”></script>
<script type=”text/javascript” src=”/sites/SiteAssets/SitePages/Scripts/Comments/spjs-cBox.js”></script>
<script type=”text/javascript” src=”/sites/SiteAssets/SitePages/Scripts/Comments/spjs-utility.js”></script><script type=”text/javascript”>
/* Add license code below this line *//* Configuration object */
var cBoxArg = {
“placeholderID”:”commentBoxInstanse_1″,
“threadID”:”Test1″,
“blogMode”:false,// Set this to true if you use this with a blog
“storeCommentsOnRootSite”:false,
“multiInstanceMode”:true, // set to false when upgrading from v1.x
“text”:{
“createdByPrefix”:”Posted by “,
“createdPrefix”:” on “,
“modifiedPrefix”:”Modified: “,
“modifiedByPrefix”:” by “,
“expandCollapse”:[“expand”,”collapse”],
“newCommentText”:”Leave a comment”,
“notSignedInText”:”You must sign in to comment”,
“replyText”:”Reply”,
“editText”:”Edit”,
“submitText”:”Submit comment”,
“canceText”:”Cancel”,
“deleteThreadText”:”Delete comment”,
“confirmDeletePrompt”:”Please confirm that you want to delete the selected item and all replies below it.”,
“showMoreCommentsText”:”Show more comments”,
“attachFileLabel”:”Attach file”, // New in v2.5
“deleteAttPrompt”:”Are you sure you want to remove this attachment?”, // New in v2.3
“localFilePathPrompt”:”It looks like you have inserted a link to a file stored on your local computer. Please upload it as an attachment instead.”, // New in v2.5
“failedToAddFile”:”It looks like the file \”{0}\” is corrupt.”, // New in v2.5
“uploadingFilesHeader”:”Uploading files – stay on this page”, // New in v2.5
“uploadFailedIllegalCharacters”:”You cannot use the character(s) \”{0}\” in the file name. Please correct and retry the upload.”, // New in v2.5
“attachmentSizeWarning”:”Failed to add the attachment.\n\nThe file \”{0}\” is {1}, but the size limit for attachments is {2} MB.”, // New in v2.5
“discardCommentPrompt”:”Are you sure you want to discard changes?” // New in v2.5
},
“textareaVisible”:false,
“containerWidth”:”700px”,
“replyLevels”:5,
“pageSize”:15,
“threadInitiallyCollapsed”:false,
“threadedCommentsIndent”:15,
“textareaHeight”:50,
“showProfileImage”:true,
“showUserEmail”:true,
“richTextInputUsingTinyMCE”:false,
“sendToRecycleBinWhenDeleting”:true,
“sortAscending”:false,
“colorMyComments”:false,
“authorCanEdit”:true,
“moderatorGroupIDorUserID”:[758],
“restrictWriteAccessToGroups”:[],
“enableAttachments”:true, // New in v2.5
“attachmentSizeLimit”:50, // In MB – New in v2.5
“hoverToShowIcons”:true // New in v2.506
};var cBoxArg2 = {
“placeholderID”:”commentBoxInstanse_2″,
“threadID”:”Test2″,
“blogMode”:false,// Set this to true if you use this with a blog
“storeCommentsOnRootSite”:false,
“multiInstanceMode”:true, // set to false when upgrading from v1.x
“text”:{
“createdByPrefix”:”Posted by “,
“createdPrefix”:” on “,
“modifiedPrefix”:”Modified: “,
“modifiedByPrefix”:” by “,
“expandCollapse”:[“expand”,”collapse”],
“newCommentText”:”Leave a comment”,
“notSignedInText”:”You must sign in to comment”,
“replyText”:”Reply”,
“editText”:”Edit”,
“submitText”:”Submit comment”,
“canceText”:”Cancel”,
“deleteThreadText”:”Delete comment”,
“confirmDeletePrompt”:”Please confirm that you want to delete the selected item and all replies below it.”,
“showMoreCommentsText”:”Show more comments”,
“attachFileLabel”:”Attach file”, // New in v2.5
“deleteAttPrompt”:”Are you sure you want to remove this attachment?”, // New in v2.3
“localFilePathPrompt”:”It looks like you have inserted a link to a file stored on your local computer. Please upload it as an attachment instead.”, // New in v2.5
“failedToAddFile”:”It looks like the file \”{0}\” is corrupt.”, // New in v2.5
“uploadingFilesHeader”:”Uploading files – stay on this page”, // New in v2.5
“uploadFailedIllegalCharacters”:”You cannot use the character(s) \”{0}\” in the file name. Please correct and retry the upload.”, // New in v2.5
“attachmentSizeWarning”:”Failed to add the attachment.\n\nThe file \”{0}\” is {1}, but the size limit for attachments is {2} MB.”, // New in v2.5
“discardCommentPrompt”:”Are you sure you want to discard changes?” // New in v2.5
},
“textareaVisible”:false,
“containerWidth”:”700px”,
“replyLevels”:5,
“pageSize”:15,
“threadInitiallyCollapsed”:false,
“threadedCommentsIndent”:15,
“textareaHeight”:50,
“showProfileImage”:true,
“showUserEmail”:true,
“richTextInputUsingTinyMCE”:false,
“sendToRecycleBinWhenDeleting”:true,
“sortAscending”:false,
“colorMyComments”:false,
“authorCanEdit”:true,
“moderatorGroupIDorUserID”:[758],
“restrictWriteAccessToGroups”:[],
“enableAttachments”:true, // New in v2.5
“attachmentSizeLimit”:50, // In MB – New in v2.5
“hoverToShowIcons”:true // New in v2.506
};SP.SOD.executeFunc(“sp.js”);
ExecuteOrDelayUntilScriptLoaded(function(){
spjs.cBox.init(cBoxArg);
},”sp.js”);SP.SOD.executeFunc(“sp.js”);
ExecuteOrDelayUntilScriptLoaded(function(){
spjs.cBox.init(cBoxArg2);
},”sp.js”);</script>
Please advise, Thanks!
- This topic was modified 8 years, 9 months ago by kman3d.
-
March 4, 2016 at 00:34 #10604
Hi,
It seems I had a bug in the code that occurred when trying to use multiple instances. Can you test v2.507 and see if this one performs better?Sorry for the inconvenience,
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.