› Forums › SPJS-Lookup › Bug: Cannot read property ‘hiddenBy’ of undefined
Tagged: Bug
- This topic has 3 replies, 2 voices, and was last updated 4 months, 1 week ago by
Alexander Bautz.
-
AuthorPosts
-
-
October 28, 2020 at 11:37 #31949
Ross
ParticipantHi Alex,
There may be a bug in the SPJS-lookup code which is causing the forms to crash on load.
Environment
SharePoint 2010 (still…)
version: DFFS_2020-09-29 (occurs on earlier versions as well)
browser: Chrome and IE 10File
DFFS_2020-09-29/plugins/SPJS-lookup.jsStack and Source
See attached image. The green arrow shows where I think you have captured the behaviour for attachments. The red arrow shows where it may have been missed.
Suggested Fix
"toggleVisibleFieldsByTab": function () { var d, index, rowObj = {}; jQspjs(".spjs_formtable_row").each(function (i, a) { var b = spjs.dffs.getFinFromTr(a); rowObj[b] = a; }); d = spjs.dffs.data.tabConfigObj[spjs.dffs.data.selectedTab].fields.slice(0); if (d.length === 0) { d = spjs.dffs.data.initialFieldsArr; } spjs.dffs.sideBySide.clear(); jQspjs.each(d, function (i, a) { var b = spjs.dffs.getRowId(a); if ( a !== "Attachments" && spjs.dffs.fieldtype[a] !== "dffs_html" && spjs.dffs.fieldtype[a] !== "dffs_row" && spjs.dffs.fieldtype[a] !== "dffs_heading" ) { if (jQspjs(b).length === 0) { var c = "<tr id='dffs_" + a + "' fieldinternalname='" + a + "' class='spjs_formtable_row dffs_missingField' style='display:none;cursor:default;'><td class='ms-formlabel'><span class='ms-h3 ms-standardheader'>" + a + "</span></td><td class='ms-formbody'><div style='color:red;border:1px red dashed;padding:3px;margin:1px;'>This field has been deleted or is not in the current content type.</div></td></tr>"; if (jQspjs(".dffsTabRow")[0].tagName === "TR") { jQspjs(".dffsTabRow").after(c); } else { jQspjs("table.ms-formtable").prepend(c); } rowObj[a] = jQspjs(b); spjs.dffs.data.hiddenColTrackerObj[a] = { hidden: true, hiddenBy: { tab: true, rule: false, accordion: false, accordionID: {}, }, readonly: false, }; } } if (i > 0) { jQspjs(rowObj[a]).insertAfter(jQspjs(rowObj[d[i - 1]])); } else { if ( spjs.dffs.fieldtype[a] === "dffs_html" || spjs.dffs.fieldtype[a] === "dffs_row" || spjs.dffs.fieldtype[a] === "dffs_heading" ) { jQspjs(rowObj[a]).insertBefore(jQspjs(".ms-formtable tr:first")); } } }); jQspjs(".spjs_formtable_row").each(function (i, a) { var b = spjs.dffs.getFinFromTr(a); if (b === undefined) { return; } index = jQspjs.inArray(b, d); if (index === -1) { /* BUG: b is undefined for attachments FIX: check if 'b' is undefined and if the table row ('a') id equals 'idAttachmentsRow', set b to the correct field internal name */ if (!b && a.id === "idAttachmentsRow") { b = "Attachments"; } spjs.dffs.data.hiddenColTrackerObj[b].hiddenBy.tab = true; if (b.indexOf()) jQspjs(a).hide(); spjs.dffs.data.hiddenColTrackerObj[b].hidden = true; } else { if ( spjs.dffs.data.hiddenColTrackerObj[b].hidden && jQspjs.inArray(b, spjs.dffs.data.initialHiddenFields) < 0 ) { spjs.dffs.data.hiddenColTrackerObj[b].hiddenBy.tab = false; if (!spjs.dffs.data.hiddenColTrackerObj[b].hiddenBy.rule) { jQspjs(a).show(); spjs.dffs.data.hiddenColTrackerObj[b].hidden = false; } } else { jQspjs(a).show(); } } if ( !spjs.dffs.data.isSP07 && typeof spjs.vLookup !== "undefined" && b.indexOf("vLookup") === 0 && index > -1 ) { spjs.dffs.loadTime("Initiating vLookup on " + b); setTimeout(function () { spjs.vLookup.renderField(b); }, 100); } }); if ( spjs.dffs.data.tabConfigObj[spjs.dffs.data.selectedTab].sbs !== undefined && spjs.dffs.data.tabConfigObj[spjs.dffs.data.selectedTab].sbs.length > 0 ) { spjs.dffs.sideBySide.apply( spjs.dffs.data.tabConfigObj[spjs.dffs.data.selectedTab].sbs ); } spjs.dffs.resizeDlg("toggleVisibleFieldsByTab"); }
-
This topic was modified 4 months, 1 week ago by
Ross.
-
This topic was modified 4 months, 1 week ago by
Ross.
-
This topic was modified 4 months, 1 week ago by
Ross.
Attachments:
-
This topic was modified 4 months, 1 week ago by
-
October 28, 2020 at 16:47 #31955
Alexander Bautz
KeymasterCan you hover over the Enhanced with DFFS link and check the “License and version information” to ensure your browser hasn’t cached the previous version of DFFS?
Alexander
-
October 28, 2020 at 23:06 #31963
-
October 29, 2020 at 16:54 #31968
Alexander Bautz
KeymasterOK,
Unfortunately I don’t have a SP 2010 environment to test in. Are you able to set a break in the line where the error occurs (your red arrow) by clicking in the line number in the left column. Reload the page and use F8 to step one field at the time and see what [b] is when it fails – that will give you the field internal name of the field.Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.