Hiding a field on a List Form

One of the more frustrating aspects of SharePoint is that permissions do not work like most people expect. Unlike a folder, where you can assign someone read access to the folder, read access to one file & edit access to another file, SharePoint access is across the board when it comes to list data. It’s more like a spreadsheet where you want someone to see & edit Columns A & C on each row but not Column B.

Anyway, one of the sites I admin for needed to hide specific buttons & fields on the Edit form for one group of users, while still allowing them to edit other fields on the form. What I ended up with was the following script that uses jQuery and SPServices to dynamically hide an item based on group membership. While it doesn’t address the larger issue of a user having edit access to the entire list item (they could still get to the fields via the datasheet view, for instance), it DOES allow you to hide specific items on the list form according to what groups the user is in.

Continue reading

SharePoint: Refreshing the page after you close a modal dialog

SharePoint 2010 introduced the modal popup dialog – many settings & features open a nice-looking dialog window rather than changing your current location or opening a whole new window like they did in previous versions. It’s all smoke and mirrors, of course – in reality you’re still opening a different window, it’s just a nice little formatted one that acts like a dialog box instead of a browser window. SP2010 comes with a packaged function for opening these windows called OpenPopUpPage, and it’s used like the following example:

modal-refresh1

This example opens an InfoPath list form. The “?IsDlg=1” part tells it not to show the navigation & other site elements. Overall, this is a handy way to deliver forms & settings pages without interrupting the user experience. Sometimes, though, you need to refresh the original page after the user finishes with the modal dialog – when changing content on the page, for example. In my case, I just tacked a window.reload(); onto the end and thought I was done. What I found, though, was that the refresh was occurring in tandem with the popup… which effectively killed the popup.

A quick google session found a few solutions, the first few of which involved writing my own function to replace the OOTB SharePoint one or overly-complicated JQuery. The fifth result I looked at, however, had a very simple solution that does exactly what I want. Turns out that all  you have to do is add the RefreshPage attribute to the event like so:

modal-refresh2

This one little change tells the function to refresh the page after closing the popup. Nice.

Farmer eaten by his own pigs…

I love to visit weird news sites, but this has got to be one of the strangest news articles I’ve seen yet.

COQUILLE, Ore. (AP) — Oregon authorities are investigating how a farmer was eaten by his hogs.

The Coos County district attorney’s office says 70-year-old Terry Vance Garner never returned after he set out to feed his animals Wednesday on his farm near the Oregon coast.

A family member later found Garner’s dentures and pieces of his body in the hog enclosure, but most of his remains had been consumed.

The district attorney’s office said in a statement Monday that it’s possible Garner had a medical emergency, such as a heart attack, or was knocked over by the animals before he was killed. But criminal activity has not been ruled out.

Authorities estimate the hogs weigh 700 pounds. The DA’s office says one hog had either bitten or been aggressive with Garner previously.