Monday, April 27, 2009

EntityEditorWithPicker rendering

I was working with a custom lookup field type today that renders with a entity editor with picker (like a Person or Group field). I discovered that the required field validation for a SPFieldLookup fieldtype didn't actually seem to work in a dataform web part (I later found out that it works if you do a "Custom List Form" Dataform, I'll post on this later). My workaround was to embed some javascript in the page with the dataform to do some client side validation (because of the way it renders, the asp.net validator in SPD also won't help). I might write up a "how I did it" post on this in detail later, but for now I just wanted to mention an interesting thing I noticed, that the entityeditor actually renders with a bunch of hidden textareas, but the user is actually typing into a contenteditable div!

Friday, April 10, 2009

Attachments field in DataView

Ran into this the other day, if you include the 'Attachments' field of a list in a dataview web part (i.e. DataFormWebPart Single Item View) you get text that says Yes or No depending on if this item has any attachments. Not exactly the behavior I was looking for; probably not the behavior ANYONE was looking for... If you want to show links to the actual attachment the same way as the normal DispForm ListView webpart shows them, remove the xslt for the attachments field and instead put:

<SharePoint:AttachmentsField ControlMode="Display" FieldName="Attachments" runat="server" Visible="true"/>


Just to be clear, I believe this will only work on a list form page. Why the @Attachment's field can't just at least output you the attachment names is beyond me...

Wednesday, April 8, 2009

Finding the DataView Web Part EditPanel

So here is a useful tip...

If you are adding a data view part to a page in SPD and you click the "Dataview properties..." link in the contextual menu, you get the SPD properties screen that doesn't actually have all of the standard webpart Edit Panel (ie toolpart for you v2 guys) options (like Target Audience for example). To get the normal UI one, go to code view and right click your '' tag. On your contexual menu here you will see "Tag Properties...", click this and you will get the normal webpart EditPanel.