Home › Forums › SPJS-Lookup › Bug: Cannot read property ‘hiddenBy’ of undefined
Tagged: Bug
- This topic has 10 replies, 3 voices, and was last updated 3 years, 7 months ago by Ross.
-
AuthorPosts
-
-
October 28, 2020 at 11:37 #31949
Hi 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 years, 1 month ago by Ross.
- This topic was modified 4 years, 1 month ago by Ross.
- This topic was modified 4 years, 1 month ago by Ross.
Attachments:
-
October 28, 2020 at 16:47 #31955
Can 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
OK,
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
-
April 28, 2021 at 15:48 #33330
This is happening to us as well, using the latest dffs V4.4.5.22_2021-04-25 on SP2013.
Unable to get property ‘hiddenBy’ of undefined or null reference
eval code (329) (1,115855)Tested in IE11, Edge Chromium and Chrome.
Appears to be occurring in the following lines. What is the fix?
{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}} -
April 28, 2021 at 16:21 #33332
More Details from Chrome Console
VM222:1 Uncaught TypeError: Cannot read property ‘hiddenBy’ of undefined
at HTMLTableRowElement.eval (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:115893)
at Function.each (jQuery.js?v=1619620789687:2)
at n.fn.init.each (jQuery.js?v=1619620789687:2)
at Object.toggleVisibleFieldsByTab (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:115738)
at Object.do_toggleSelectedTab (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:119314)
at Object.initSelectedTab (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:129936)
at Object.applyRules (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:226205)
at Object.loadCustomJS (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:195546)
at Object.loadDependencies (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:197060)
at HTMLDocument.eval (eval at <anonymous> (DFFS_frontend_min.js:9), <anonymous>:1:170204)After using console to put a break in there, it iterates through the fields, down to “ID”, then it iterates to a blank item “”, which causes the error.
- This reply was modified 3 years, 7 months ago by Matthew Wolfe.
-
April 28, 2021 at 18:36 #33335
Can you show me a screenshot of the fields you have configured in the tab where you get this error? – also, if you can explain what you do when you get this error it might help me try to figure it out.
PS: Remove any sensitive information from the screenshots. If you want to email them to me rather than post them here you can email them on the address you get this notification from.
Alexander
-
April 28, 2021 at 18:47 #33339
Thanks for the reply Alex!
I figured it out. The user had pasted some text into a multi-line text field in one record, and it had some special characters. Once I cleaned up the text for them, it renders the form just fine, no error.
Let me know if you need any other details, otherwise, I think I’m set.-
April 28, 2021 at 19:01 #33343
I’m glad you figured it out. I don’t need anything else from you on this, but I’m also not sure this is something I can prevent.
Alexander
-
-
April 28, 2021 at 19:02 #33345
No problem. Thank you for the solid tool!
Will educate the team to help avoid this in the future.
Take care! -
May 21, 2021 at 08:08 #33598
For anyone else looking at this bug. This issue does not occur in the latest versions of DFFS (as of 21 May 2021).
I’m not sure what version resolved it but using the latest DFFS should be enough.
-
-
AuthorPosts
- You must be logged in to reply to this topic.