0

I am working on an EnterpriseWiki site collection, and when users edit the page properties as follow:-

enter image description here

then will get all the fields inside the EnterpriseWiki content type as follow:-

enter image description here

now i want to hide all the fields and only keep two values ; Title & Name, so i edit the EditForm and i add the following script:-

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

and now when users edit the wiki page properties they can only edit the name & title. but my question is what will happen to the other values such as the page content, assign to , etc.. now i test this and seems that when editing the name and title the other values will not get effected which is what i need, but not sure how did SharePoint handle this, i was affraid that hiding the other columns will set their values as null or empty if the user save the editform with only the title and name inside it ? can anyone adivce on this ?

8
  • 1
    i think best thing is test it on test wiki page. Commented Apr 28, 2015 at 19:25
  • as i mentioned that based on my own test only the title, name , modified by and modified will be updated while the other values (the fields that have been hidden using javascript) will not get affected,, but not sure if this will always be the case??? Commented Apr 28, 2015 at 19:36
  • 1
    what i believe, if you are hiding all the columns, then those value will not changes expect the modified by. what ever value exist at first will remain their. Commented Apr 28, 2015 at 19:39
  • @WaqasSarwarMCSE i am not hiding all the columns, i will only show two fields Title & Name and hide the other fields,, my question is what will happen to the values that have been hidden... from my test seems the hidden values will not get affected which is what i am looking for,, but will this always be the case? or i can not rely on this test ? i am a bit confused. Commented Apr 28, 2015 at 19:52
  • 1
    that is what i am saying, when you hide a column, the value of that still remain same(what ever you enter 1st) expect the complex column, i.e modified by, calculated... Commented Apr 28, 2015 at 19:57

2 Answers 2

2

If you do a .remove() instead of a .hide() the fields could (although I haven't seen it to be the case) get blanked out. You would likely see some sort of post back error in that the HTML delivered is different than what was sent, I saw this a lot when trying to modify dropdown lists.

If you hide the rows with a .hide(), the fields are still present in the markup but CSSed away via JavaScript. The fields will retain their values when saved.

20
  • 1
    I would lean towards using .hide, just to be on the safe side. Ripping it out of the DOM using .remove could lead to unintended consequences that aren't really necessary. Commented Apr 28, 2015 at 19:56
  • 1
    jQuery hide() only sets style="display:none;" more or less. Setting the hidden attribute is not the same as display: none; Commented Apr 28, 2015 at 21:16
  • 1
    Correct. Yes .hide is display:none, not visibility hidden Commented Apr 29, 2015 at 0:49
  • 1
    if you are using .hide, the fields are on the form and the values present will get saved, you are just obscuring them from the display with CSS. The values will persist Commented Apr 29, 2015 at 14:09
  • 1
    Possibly yes, I'd try a different selector Commented May 1, 2015 at 13:11
0

Out of the box columns as well as columns with default values set will not get affected.

For example Out of the box columns like Created, Modified, Created By, Modified By will get populated automatically.

All custom fields which don't have default value set will store Blank values.

3
  • but based on my test the custom columns that have been hidden will not get affected ,,, and only the title and name in addition to the modified by and modified will be updated... Commented Apr 28, 2015 at 19:35
  • Yes custom column might have default values set. Commented Apr 28, 2015 at 19:36
  • no my custom columns do not have defualt values , and when i hide them using javascript their values did not changed, but not sure if this will always be the case ?? or might be changed on certain scenarios ? Commented Apr 28, 2015 at 20:32

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.