Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been tasked with setting up a calendar on SharePoint 2010 Foundation to record bookings.

I would like to use a custom display form so I can remove and/or reorder the fields. I created a new display form using SharePoint Designer 2010 (Navigated to subsite > Lists and Libraries > myList and clicked New... under Forms section, and chose Display type).

Using the new Display form I have noticed a few bugs/inconsistencies.

First, lookup fields revert to showing raw HTML, rather than a link. I fixed that by adding

disable-output-escaping="yes"

to the xsl tag attributes.

Second, dates seem to show as a full ISO date, rather than a more readable dd/MM/yyyy HH:MM format. I thought I could solve this by adding the code below

<xsl:value-of select="ddwrt:FormatDate(string(@EventDate),2015,5)"/>

In the design view in SharePoint Designer, the desired formatting shows up. However, when I view an item on the site itself (through IE) the field is blank. I cannot work out why Designer shows the correct result, but the site itself does not. I can't even find anyone else online with the same issue. Hence this post.

This image shows the SharePoint Designer 2010 Design view. The Start Time has been formatted using the formula above and displays correctly. The End Time is the default ISO format. This is the SharePoint Designer Design View.

Viewing an event using the custom display form via the site is shown in this image. The formatted date is not displayed at all. This is the custom Display form as viewed on the SharePoint site.

Is there a way of getting the site to properly display the date with the formatting formula applied? Better still, is there a way of customising the display form without these annoying quirks? (Boolean fields showing as 1/0 rather than Yes/No. Recurrence field showing 1/0 rather than the actual recurrence schedule etc).

share|improve this question

2 Answers 2

Recurrence field showing 1/0 rather than the actual recurrence schedule

I've learned that you can show @RecurrenceData rather than @fRecurrence, which outputs something like this:

<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily dayFrequency="1" /></repeat><windowEnd>2013-03-12T20:00:00Z</windowEnd></rule></recurrence>

rather than a zero. It's still not great, but at least you can kind of figure out the recurrence schedule from that output. Maybe if you know how to convert an xsl output into html, you could share with me?

I'm working on creating a display page for calendar items that is more print-friendly than the default.

Thanks!

share|improve this answer

Peter,

When you add a custom display form it doesn't works as OOB Display Form...

This image shows the SharePoint Designer 2010 Design view. The Start Time has been formatted using the formula above and displays correctly. The End Time is the default ISO format.

This is happening because by default your custom display web part will be taking the first event in the Calendar list, you will need to add a Parameter to your display form and take the EventId/ListItemId from Query String.. Then filter the display form with this Query String Variable on ID field..

Optionally, limit the display form to show 1 Item, this can be done by clicking Ribbon -> Data View Tools -> Options -> Paging -> Limit to 1 Item

(Boolean fields showing as 1/0 rather than Yes/No.

You can apply some xsl to fix this, something like:

<xsl:choose>
     <xsl:when test="@BooleanFieldName='1' or msxsl:string-compare(string(@BooleanFieldName),'Yes','','i')=0 or msxsl:string-compare(string(@BooleanFieldName),'True','','i')=0">Yes</xsl:when>
     <xsl:otherwise>No</xsl:otherwise>
</xsl:choose>

Recurrence field showing 1/0 rather than the actual recurrence schedule

Don't know about this one, I guess you need to add a List View to show all the recurrent Events...!

I hope this helps

share|improve this answer
    
Arsalan, There was already a ListItemID parameter and it is set to get the value from the query string. I changed the Paging to Limit to 1 Item. Nothing changed. To reiterate, the custom form was created via SharePoint designer using the New form button. The custom form was built by SharePoint with all the columns for my calendar list. –  Peter Spain Dec 13 '12 at 11:12
    
If ListItemID was already a Parameter set to get value from Query String then use this to filter the Display form! And how come "New Form" button gave you display form?? :)... –  Arsalan Adam Khatri Dec 13 '12 at 23:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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