Cannot read property 'replaceChild' of null
Hi,
I have 2 related-item. I get below error when I edit an item. How can I fix this issue?
Best regards.
I have 2 related-item. I get below error when I edit an item. How can I fix this issue?
Best regards.
Code: Select all
setHash();
setHash2();
function setHash(){
fd.field('Year').readonly(true);
var d = new Date();
var yil = d.getFullYear();
value = encodeURIComponent(escape(yil)).replace(/\-/g, "%252D");
window.location.hash = "InplviewHash" + $(".ncrTable [webpartid]").attr("webpartid") + '=FilterField=Year-FilterValue=' + value;
}
function setHash2(){
var d = new Date();
var yil = fd.field('Year').value();
var hash = window.location.hash;
value = encodeURIComponent(escape(yil)).replace(/\-/g, "%252D");
window.location.hash = hash + "#InplviewHash" + $(".indirectNcrTable [webpartid]").attr("webpartid") + '=FilterField=Year-FilterValue=' + value;
}
- Attachments
-
- Screenshot_26.png (17.53 KiB) Viewed 3328 times
Last edited by ksertkaya on 09 Dec 2019, edited 1 time in total.
Hello ksertkaya,
This error means that you are accessing a property of an object that is null. But in the code provided there is no 'replcaeChild' property.
Is that a complete code that you have in the form?
Could you please share all code so I could troubleshoot the issue.
This error means that you are accessing a property of an object that is null. But in the code provided there is no 'replcaeChild' property.
Is that a complete code that you have in the form?
Could you please share all code so I could troubleshoot the issue.
Code: Select all
setHash();
setHash2();
function setHash(){
fd.field('Year').readonly(true);
var d = new Date();
var yil = d.getFullYear();
value = encodeURIComponent(escape(yil)).replace(/\-/g, "%252D");
window.location.hash = "InplviewHash" + $(".ncrTable [webpartid]").attr("webpartid") + '=FilterField=Year-FilterValue=' + value;
}
function setHash2(){
var d = new Date();
var yil = fd.field('Year').value();
var hash = window.location.hash;
value = encodeURIComponent(escape(yil)).replace(/\-/g, "%252D");
window.location.hash = hash + "#InplviewHash" + $(".indirectNcrTable [webpartid]").attr("webpartid") + '=FilterField=Year-FilterValue=' + value;
}
ksertkaya,
What is the type of the 'Year' field? Is it a text field or drop-down?
What is the field type of the Year field in the related items?
Related items are List items or Library documents?
Could you please share the screenshot of the form, so I will have the full picture.
What is the type of the 'Year' field? Is it a text field or drop-down?
What is the field type of the Year field in the related items?
Related items are List items or Library documents?
Could you please share the screenshot of the form, so I will have the full picture.
Year is number field.
Code: Select all
function IsCurrentUserMemberOfGroup(groupName, OnComplete) {
var currentContext = new SP.ClientContext.get_current();
var currentWeb = currentContext.get_web();
var currentUser = currentContext.get_web().get_currentUser();
currentContext.load(currentUser);
var allGroups = currentWeb.get_siteGroups();
currentContext.load(allGroups);
var group = allGroups.getByName(groupName);
currentContext.load(group);
var groupUsers = group.get_users();
currentContext.load(groupUsers);
currentContext.executeQueryAsync(OnSuccess,OnFailure);
function OnSuccess(sender, args) {
var userInGroup = false;
var groupUserEnumerator = groupUsers.getEnumerator();
while (groupUserEnumerator.moveNext()) {
var groupUser = groupUserEnumerator.get_current();
if (groupUser.get_id() == currentUser.get_id()) {
userInGroup = true;
break;
}
}
OnComplete(userInGroup);
}
function OnFailure(sender, args) {
OnComplete(false);
}
}
function IsCurrentUserHasContribPerms()
{
setHash();
setHash2();
IsCurrentUserMemberOfGroup("Procurement Members", function (isCurrentUserInGroup) {
if(isCurrentUserInGroup)
{
$('.readOnly').find('input,textarea,select').attr('disabled', false);
$('#fd_tabcontrol-0').tabs('option', 'disabled',null);
fd.field('Year').readonly(true);
}
});
}
ExecuteOrDelayUntilScriptLoaded(IsCurrentUserHasContribPerms, 'SP.js');
- Attachments
-
- Screenshot_29.png (19.28 KiB) Viewed 3283 times
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests