1

I am working on an enterprise wiki site collection, now when the user edit the properties of the page he will be redirected to the following page :-

enter image description here

so i wanted to hide all the fields except the Name and title, so inside our testing server i edit the page then i added the following code snippet :-

<script> $('#formTbl tr').filter(function () { return !$(".ms-standardheader", this).text().match(/Name|Title/i); }).remove(); </script> 

where it hide the unwanted fields. now i did the same steps on our live server but the script raised the following error:-

SCRIPT5007: Unable to set property 'ListId' of undefined or null reference EditForm.aspx, line 1230 character 1

so can anyone advice on this please ?

4
  • It seems there is some other script error on the page. Remove you custom script and see what is causing this error. Commented Apr 28, 2015 at 15:44
  • if i remove the custom script no errors will be raised... Commented Apr 28, 2015 at 15:44
  • can you adivce more on this ? where i need to add this ? Commented Apr 28, 2015 at 15:53
  • I added it as an answer. Hope it works. Commented Apr 28, 2015 at 15:54

1 Answer 1

1

Try

<script> $(document).ready(function(){ $('#formTbl tr').filter(function () { return !$(".ms-standardheader", this).text().match(/Name|Title/i); }).remove(); }); </script> 
5
  • thanks using your code i was able to hide the unwanted fields , but i am getting this error now :-SCRIPT5007: Unable to set property 'AllowWebParts' of undefined or null reference Commented Apr 28, 2015 at 16:02
  • 1
    Ok instead of .remove.. try .hide() Commented Apr 28, 2015 at 16:03
  • using .hide() worked well, but now i am 100% confused , as my original script worked well on the testing server , but it did not work on the live server, so what could be the reason behind this ? second question, why using .hide instead of .remove solve the second problem ? Commented Apr 28, 2015 at 16:10
  • Error says null reference.. This happens when object is not found.. In your case remove might have cause this.. These where all guess and luckily it worked. Not sure about why it happened only in Live. Commented Apr 28, 2015 at 16:11
  • now i move your code to the testing server and it worked .. Commented Apr 28, 2015 at 16:18

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.