Posted by: benjamindavies | May 19, 2009

Custom List Form

One of the most frequent questions I’m asked is to customise a SharePoint list form, not just the page in general but the list items themselves albeit new, edit or display form.  Often the reason is to surpress some fields that are visible by the end user, such as admin fields, or on occasion to display different fields to different users.  However you need to apply this you will need to use SharePoint Designer, firstly I will show you and easy way to surpress fields using SharePoint Designers built in controls.

Custom List Form (static)

This is to amend the default list form, in this example I will use the new form.  Firsly open the form in SharePoint Designer, either locate the form through the browser and through the file menu select “edit in SharePoint Designer”, or locate the form in SPD, (site > lists >your list > newform.aspx).  This results in the below view, you will notice it does not look like the items in you list, it shows you a default view as it links back to the original list, by customising it you will no longer inherit any changes made to the list (i.e. new fields added will not be displayed). First need to get rid of the “listformwebpart”, you can either simply delete this or if you want to you can just mark it as hidden in the properties. 

image of list form

image of list form

Now you need to insert a custom list form into a cell by selecting insert > SharePoint Controls > Customs list form. 

insert

You will the be presented with the below, you need to select your list, then select which kind of form you are customising in this case, it is the new form. 

formtype

You will notice you can see all of the list items on your form, you can simply delete the cells you don’t wish to be displayed, (probably best not deleting mandatory fields).  Save and done!

Target list item fields.

You may require different fields depending on user, in this case you can use the above method, but create however many different view you need on the same page, you can just stack this down the page, but enter these is separate webpart (so you will have to insert some more webpart zones).  Once save and you open in the browser you will then end up with a long list with multiple forms stacked up. 

Now you can edit the page as it is customised, presuming you followed the above and inserted the various custom lists views into separate webparts you can now target the individual webparts at different audiences.  You will need to take the time to create the  SharePoint Groups in order to target.  Once created you can Modify the webpart, then expand the Advanced option in the right hand menu, and the bottom field will allow you to select your target audiences.

 

Use Javascript instead?

You can produce the same results as above by using Javascript, the advantage of this is that you do not have to create these static list forms, so any changes you make to the list will be retained in the forms and  you can tweak accordingly from the browser.  You will still need to use SPD to create some webpart zones on the page so you can insert the Javascript into a content editor Webpart (CEWP), again you will need to create multiple zones if you wish to target.  You just have to add the field names into the below as desired, you can just repeat the duel control lines below for as many fields as required (I use excel to save time formatting).  Remember targeting audiences you will be to targeting the Javascript, the suppressing agent, worth keeping in mind, any that isn’t targeted will be universal

<script language=”javascript” type=”text/javascript”>

_spBodyOnLoadFunctionNames.push(“hideFields”);

function findacontrol(FieldName) {

   var arr = document.getElementsByTagName(“!”);
   // get all comments
   for (var i=0;i < arr.length; i++ )
   {
      // now match the field name
      if (arr[i].innerHTML.indexOf(FieldName) > 0)
      {         return arr[i];      }
   }
}

function hideFields() {
   // debugger;
   var control;
   // Add a line for each control to be hidden

   control = findacontrol(“Your Title Field Name to Hide”);
   control.parentNode.parentNode.style.display=”none”;

}

</script>

Posted by: benjamindavies | April 16, 2009

Blasted Title Field

Ever wanted to get rid of that mandatory required title field from a list, rather than just renaming it?
Well you can by enabling content types for the list, then disabling it, SP will take it off your forms for you aswell

A detailed how to here:
http://www.dlocc.com/sharepoint-main-menu/customization-category/46-how-to-remove-the-qtitleq-column-from-a-sharepoint-list.html

Posted by: benjamindavies | April 3, 2009

Hide parts of a Sharepoint page

Customise a Sharepoint page – Front End User

Out of the box Sharepoint pages aren’t the easiest for the end user to customise, and I find people that choose to use a Sharepoint page don’t actually want it to look like sharepoint. Well whatever your reasoning here is a simple way to get rid of that unwanted content. N.b this method is suitable where you only need to customise individual pages, to change a site level see below using designer

Sharepoint pages uses a master CSS and Classes to render content, (you can attach your own style sheet for site level changes), the good thing about CSS is that it retains the last command so it is easily overridden using a webpart. By using a Content Editor Webpart (CEWP), and using Style tags you can change the style of the Classes. So you need to find the name of the Class you want to change or hide, you can use IE Add-on called IE Developer, or something like firebug in ff. You can see all the classes are highlighted, you just need the title.

Let’s get rid of the quicklaunch menu.

Edit page and add a Content Editor Webpart to a webpart zone, it doesn’t matter which one as by changing the Chrome type to none it will not be displayed on the final page.

Edit the webpart and select edit source, pasting in the below to hide the quick launch menu

<style>
.ms-quicklaunch
{
display:none;
}
</style>

ms_hide1

Hey presto! You can hide as many as you wish, or indeed change other aspects of the style, like the width for example, which would be “width:300” instead of “display:none” in the above. This method is ok if you only need to customise one or two pages.

Using Sharepoint Designer

If you need to do it to the entire site then you should edit the master page, which is the template that can be used for all of your pages in a site collection. To do something similar, hiding content, you can use an asp panel, this is an asp control that you can wrap around the content place holders on the page you wish to suppress.

Open the sites masterpage in Designer, under _catalogs > Masterpage, it will be the default.master unless you’ve changed it. Put the Designer screen into split mode, so you can see both the page design at the bottom and the code at the top, it can be useful to locate the necessary code by selecting the section that you wish to hide in the design view, the you need to wrap your selection with the asp panel. As always, intellisence will assist you with this, type the top line of the below, as soon as you close your angled brackets it will insert the closing tag that you can move to the end of the code you wish to be wrapped

<asp:Panel ID=”Panel1″ Visible=”false” runat=”server”>
<asp:ContentPlaceHolder ID=”PlaceHolderLeftNavBar” runat=”server” />

</asp:Panel>

Posted by: benjamindavies | March 28, 2009

Format Date Time in a Sharepoint list

Date fields in a SharePoint lists sometimes need a little tweaking to get them to do what you want. Every list will automatically include the date field “Created”, this is saved as Date and Time, I will use that one as an example. The problem with Date Time is that it’s not particularly helpful when you are analysing your data, for most lists that I use I usually like to group or filter by the date, either daily, or more commonly monthly, something that you cannot do with the date time field.

There are several ways to achieve this; it is easily rectified by using a calculated field, creating a new field in the list using a formula to format the date from the existing date time field. So this method is simply;

Day
Create a Column, select Calculated field, enter in the formula: =Created
Then select the data type returned from the formula to Date and Time, and the change the format to Date Only. This will return the Date without the time so you will be able to manipulate this to group or filter by day. Example; 01/01/09, rather than 01/01/09 12:00PM.

Month
For smaller lists you may want to group by month, or even just display the month rather than the whole date time. So to display the month, again use the calculated field, but this time you will select data type single line of text, using the below in the formula;

=TEXT(Created,”mmmm”) returns “January”

Where “Created” is the column name, you can use any column that is used for date. You can then group this field by month, but this will be sorted alphabetically. If you want to display this in chronological order you can only do this by manipulating the group by variables. If you are familiar with querying databases you will probably know that, mm=01, mmm=Jan, mmmm=January, yyyy=2009…etc etc… this makes it easy to format the date in such a way that will be in order, formula;

=TEXT(Created,”mm”)&TEXT(Created,” mmmm”) returns “01 January”

If you want to display a combination of day month & year, the formula can be more simple, you can also use special characters to separate them, such as :;-‘,.

=TEXT(Column Name,”dd mmmm ‘yy”) returns “01 January ’09”

There are loads more ways you can manipulate the date to meet your needs using calculated fields, but these are most useful to me.

Posted by: benjamindavies | March 16, 2009

No More Messy Desktop

If you’re like me you will often save things to your desktop for quick access, I know this is not best for performance but it is too convenient not to use. I also like to keep quite a few shortcuts on there also. I lived with auto arrange for a while, which is fine for a few but losses it usefulness once you have numerous items. A number of items I know is self inflicted, call it compulsion, but I can’t help it that I need a range to web browsers to choose from. I did try to arrange them myself for I while wh

ich wasn’t too bad, but I always felt a void, there was something more I was sure.

There is! Desktop fences, it’s quite swish. Its basically is what you would expect, it allows you to ring fence icons however you wish in an intuitive fashion, its just so natural allowing you to drag and drop as you would anyway. And it looks pretty neat too!http://www.stardock.com/products/fences/

A desktops from home with fences:

desktop fences image

Posted by: benjamindavies | March 2, 2009

Instant Messenger, software of choice

logo_pidginadium

Ok, so I have established several ways to communicate with the masses, well to whoever will listen, via blogging, twittering, etc. where you may get the odd comment, may be if you say something inspired or rustle some feathers, usually the later. But for me you can’t beat a good old one on one conversation? And what better tool than instant messaging. I’ve never been one for picking up the blower so IM has held me in good stead for many a year. But through the years IM clients have been getting increasing bogged down with too many distractions and feature’s, for example, I hate the advertisements at the bottom of live messenger, buzzing away in my peripheral vision, besides that how many different clients do you need and who supports who? Well it was a small annoyance for me anyway.

instantmessenger

 

That was of course until I started delving into the world of open-source, for solutions to all my problems. So there are a few IM Clients out there, so I had a little browse, if I had a Mac Air, then I would use Adium, the cute little green duck. But as I’m mostly using windows I had to go for Pidgin, not quite so cute a mascot, but it’s not just about looks. So what’s the difference to a commercial client? Well first of all its free, always nice, so not cluttered with billboards. It’s a lot lighter than most other clients and its portable so I can carry it around and run it from a usb stick to save me setting up my accounts. It connects to every chat network I have heard of and lots I haven’t. There are many plugins both supported and third party non-supported, that give you huge scope for customisation.

 

What’s it really like to use? Well it is just a joy! Firstly I added all of my chat accounts, msn, yahoo etc. very clean and simple, a slim window displaying my online contacts, categorised, with a small icon to the right of their profile pictures, that instantly blow up on hovering to a nice size. Then I added my myspace and facebook login details, wow, my contact list is growing, I have subsequently been accused of being a stalker by a close friend, it’s not my fault, now my facebook friends are lumped in with the rest of my contacts, there is no escape as I get a pop-up when someone is just quietly checking if they have any friend requests. The facebook feature is an plugin I should add, as are the toaster pop-up notifications, but many come with the original download that can just be turned on. There are many other plugins worth a look like Twitter updates and history. But I won’t spill all the beans, I hope this is enough to at least give it a whirl. One alias is benjamin_davies@msn.com if you want to chat J

Posted by: benjamindavies | February 16, 2009

Internet Explorer Crash in MOSS Fix

This MOSS/IE/Excel or should I say microsoft issue occurred for me some time ago, but thought it was work publishing due to it resurfacing with a colleague.
The problem is when Internet Explorer crashes and closes down when you try to open an excel spreadsheet on sharepoint, it occurs when an office 2007 software has been installed (e.g. SharePoint Designer 2007, Visio 2007), mixing Office 2003 & 2007 software.  So if you don’t fancy installing the entire Office 2007, (which will nullify the problem) the below procedure will fix this.

At the following path:
C:\Program Files\Microsoft Office\office11 and office12 folders
copy the owssupp.dll file from the lower numbered office folder and paste it to the upper numbered folder i.e. copy the file from office11 and paste it to office12. (Office12 will also have this file, I would back up that file before the above procedure and save it somewhere on the disk, instead of overwriting it with the office11 file)

Next
1. Go to Start Menu
2. Run
3. Type: regsvr32 “C:\Program Files\Microsoft Office\Office12\owssupp.dll”
4. Click ok to the error message.

Voilà

Categories