Sharepoint Online Hide A Field

11.09.2019

You can show or hide columns in a list or library as an alternative to deleting. When you hide a column, it doesn't affect the column or the data in the column, as it would if you deleted it. To reuse the column, you can just show it again. Requirement: SharePoint Online PowerShell to Hide Field In a project request list, when user fills the form we wanted to hide the 'Status' column by default and then have a workflow to populate status of the particular request.

Sharepoint

I have a SharePoint list with the following single line of text fields: Title, Year and Type or Location. I want to be able to hide the Type or Location table row in the default display form. I know that I should create a JavaScript script and put it in Content Editor web part inside DispForm.aspx.

I am not fluent with jQuery syntax, thus I need help with the code, i.e. I don't know how to reference the table row which contains Type or Location field and its value. Here's what I've done so far, but it doesn't work:

I know that the 'input[title='Type or Location']' part is incorrect; at least I think it's that. Could anyone help me out? Thank you.

Sharepoint
Boris
BorisBoris
4,99629 gold badges91 silver badges138 bronze badges

6 Answers

Rich BennemaRich Bennema
9,4804 gold badges32 silver badges53 bronze badges

I am not sure why you want to use jQuery for that. In SharePoint, you can choose to make a field required, optional or hidden. In most cases, just switching to hidden will address your issue.

For the record, I would also try to avoid as much as possible the use of jQuery(document).ready, it might conflict with the SharePoint out of the box onload event. In your case it is not needed.

Spotify not working on pc. 8) Try starting up spotify again. (Hopefully it will start up with the new update!) I'm not sure WHY this works, but it did for me. Hope this helps! Having the same issue, starting today, on Windows 7. It is listed as an exception in my firewall and my antivirus is not blocking it.

Update: here is a way to do this with jQuery:

ChristopheChristophe
16.1k19 gold badges76 silver badges122 bronze badges
Chris GesslerChris Gessler
18.6k3 gold badges39 silver badges73 bronze badges

It depends what type of column Type ior Location is. If it's a Single line of text, then you're close. You should use a DOM inspector like IE's Developer Tools or Firebug to see what the actual title of the input element is.

If the column is a different type, then it's likely not an input element. Using the DOM inspector again, you can look at what elements make up the field control and decide on your selector from that.

Finally, remember that hiding things in script is not secure. A savvy user can turn off the script or otherwise change the script so that they can edit it. It all depends on your requirements.

// UPDATE //Ah, you said DispForm. As was pointed out in another answer, there aren't any input elements in a DispForm. You need to correct your selector.

Marc D AndersonMarc D Anderson

Sharepoint Online Hide Field In Newform

If its just the Default Display Form, How about just creating a view and making it default?

AR Ebhendra PagotiAR Ebhendra Pagoti

Hide A Field Sharepoint Online List

Drew Gaynor
6,5455 gold badges33 silver badges47 bronze badges
KishanKishan
Field

Not the answer you're looking for? Browse other questions tagged javascriptjquerysharepoint or ask your own question.

Comments are closed.