From what I have seen so far of the SharePoint 2010 Beta, we are going to have almost limitless possibilities for improving the user experience. The new ribbon will become an important tool for managing user navigation and the new dialog framework is a very neat approach. Master pages now understand when they are being displayed in what seems to be a modal dialog box, and so do not display full navigation in this context. All this is achieved quite simply using CSS and JavaScript (it is stunning in one sense to think that it has taken us so long to get this far, using such standard tools). Some things in the new SharePoint 2010 universe are much trickier to achieve than in the old MOSS environment however. Take creating a link in the Quick Launch Menu to the NewForm.aspx in a simple list. This used to be an easy way of directing users and cut out a click or two in the process. Well, you can still use the same procedure and the result functions, but you do not get the now familiar dialog experience.

The form opens embedded in the page. While it is useful that the site is still able to function, this undermines somewhat the very smooth new user experience. Is there a way to open a new list form in the modal dialog format?

So far, the only means I have found to achieve this is by creating a feature which creates a new button on the Ribbon which can then open NewForm.aspx. I have adapted code described by Jonathan Frost on his blog here.

Whereas he is adding a new button to the Documents tab of a Document Library Ribbon, I want to add a button to the New tab of a Generic List. To do this you will need to change Jonathan’s code such that the RegistrationId is set to 100 for a generic list (not 101 for a Document Library) and you will need to set the Location and ID in the CommandUIDefinition to Ribbon.ListItem.New.Controls._children

As follows:

The result is a button which appears as follows once the feature is implemented:

The NewForm.aspx opens in a modal-type dialog consistent with the SharePoint 2010 user experience:

The disadvantage with this approach is that you will get the New Project button appearing on every Generic list and it will always open the NewForm.aspx for the list referenced in the URL of your code. So this workaround takes us some of the way: it is useful but not yet 100 per cent functional.

Advertisements