1,726 articles and 13,241 comments as of Wednesday, October 13th, 2010

Thursday, July 1, 2010

SharePoint: Extending the DVWP – Part 15: User-Managed Dropdowns with Site Columns

Author: Jim Bob Howard

Why Site Columns for Dropdowns?

Marc Anderson calls site columns a single version of truth to be used in many places. When used in conjunction with a lookup into a table at the root of a site, a site column can be used throughout a site collection and yet always reference the single version of truth.

  1. Create a list
    Create a simple list named for the site column you want to create. It only needs a Title column.
    1. At your site root (i.e. http://site or http://site/subsite), click on Site Actions > Create


    2. Click on Custom List under Custom Lists


    3. Give your list a Name


    4. Click the Create button
    5. Now that it’s created, you’ll need to give at least Contribute permission to whoever is going to maintain this list. And you’ll need to give Read permission to everyone who will be using a list that accesses this data.
  2. Create a site column
    Create a site column that is a lookup into the list you just created
    1. At your site root, click Site Actions > Site Settings


    2. Click on Site columns under Galleries


    3. Click Create, located just above the Site Column row header


    4. Give it the same name as your list


    5. Check Lookup (information already on this site)
    6. First time through, if you don’t have a Custom Columns group, I recommend you create one by checking New group and naming it. On following site column creations, you will be able to choose your new group from the Existing group list.
    7. Enter an optional Description
    8. I prefer to check No under Require that this column contains information; I can control its requiredness when I add this site column to my actual list.
    9. Under Get information from, choose the list you just created
    10. Under In this column, choose Title
    11. Click the OK button
  3. Add it to your list
    For each dropdown, add a site column to your list
    1. From your list, click Settings -> List Settings


    2. Settings -> List Settings

    3. Under Columns, click Add from existing site columns


    4. If you created a custom group for your site columns, choose it


    5. Click all of the columns you want to add (Ctrl-click to select more than one)


    6. Choose Columns from Site Columns

    7. Click Add > to add all of them


    8. Add Columns from Site Columns

    9. Choose options appropriate for your project and click OK


Now your dropdown data is maintained in one place and your list will always have the most up-to-date list.

Next time: Now that the site columns are in place, we’ll create relationship lists which will allow us to cascade (or limit) one dropdown based on the choice in another (e.g. if Country is set to USA, limit State to states within the US only).

Author: Jim Bob Howard

Jim Bob Howard is a web designer / webmaster in the healthcare industry. He has been working with SharePoint since March 2009 and enjoys sharing what he has learned. He is a moderator and frequent contributor to Stump the Panel, and answers SharePoint questions on Twitter (@jbhoward) and via email ([email protected]).

View all entries in this series: Extending the DVWP»
Entries in this series:
  1. SharePoint: Extending the DVWP - Part 1: Layout Enhancement - Rearranging Columns - Default and Edit Templates
  2. SharePoint: Extending the DVWP - Part 2: Layout Enhancement - Rearranging Columns - Insert Template
  3. SharePoint: Extending the DVWP – Part 3: Getting it All on One Line - DVWP Function Action Links
  4. SharePoint: Extending the DVWP – Part 4: Turning DVWP Action Links into Buttons
  5. SharePoint: Extending the DVWP – Part 5: Doing Stuff Before Save on Submit - PreSaveAction()
  6. SharePoint: Extending the DVWP – Part 6: Examining the Form Action Links
  7. SharePoint: Extending the DVWP – Part 7: Creating a Form Action Workflow
  8. SharePoint: Extending the DVWP – Part 8: Creating a Form Action Workflow - The After Math
  9. SharePoint: Extending the DVWP – Part 9: Oops! Failed Setting Processor Stylesheet
  10. SharePoint: Extending the DVWP – Part 10: Passing Workflow Variables to a Form Action Workflow
  11. SharePoint: Extending the DVWP – Part 11: Getting More Form Fields to the Workflow
  12. SharePoint: Extending the DVWP – Part 12: Adding More Form Fields from the Data
  13. SharePoint: Extending the DVWP – Part 13: Putting PreSaveAction() to Work – Creating Variables
  14. SharePoint: Extending the DVWP – Part 14: Putting PreSaveAction() to Work with jQuery
  15. SharePoint: Extending the DVWP – Part 15: User-Managed Dropdowns with Site Columns
  16. SharePoint: Extending the DVWP – Part 16: User-Managed Dropdowns - Loading Data
  17. SharePoint: Extending the DVWP – Part 17: User-Managed Dropdowns – Creating a Relationship list
  18. SharePoint: Extending the DVWP – Part 18: User-Managed Dropdowns – Loading the Relationship list – Part 1
  19. SharePoint: Extending the DVWP – Part 19: User-Managed Dropdowns – Loading the Relationship list – Part 2
  20. SharePoint: Extending the DVWP – Part 20: Cascading Dropdowns - Applying the jQuery
  21. SharePoint: Extending the DVWP – Part 21: Cascading Dropdowns - Three-tier Cascade
  22. SharePoint: Extending the DVWP – Part 22: Creating Title Based on Other Fields with jQuery
  23. SharePoint: Extending the DVWP – Part 23: Creating Title Based on Other Fields with a Workflow
  24. SharePoint: Extending the DVWP – Part 24: A Note to Readers
  25. SharePoint: Extending the DVWP – Part 25: Using an Audit Trail by Creating List Items with SPServices
  26. SharePoint: Extending the DVWP – Part 26: Modifying the Edit Template
  27. SharePoint: Extending the DVWP – Part 27: Adding an Alternate Edit Template to a DVWP
  28. SharePoint: Extending the DVWP – Part 28: Massage the Remove Template
  29. SharePoint: Extending the DVWP – Part 29: Modifying Form Action Workflows on the remove Template
  30. SharePoint: Extending the DVWP – Part 30: Using EasyTabs with Filtered DVWPs to Make Data Manageable
  31. SharePoint: Extending the DVWP – Part 31: Filling in Default Data on the insert Template with jQuery
  32. SharePoint: Extending the DVWP – Part 32: Filling in Default Data on the insert Template with Multiple DVWPs
  33. SharePoint: Extending the DVWP – Part 33: Modifying Total and Subtotal Row Layouts in DVWP
  34. SharePoint: Extending the DVWP – Part 34: Using Icons for Form Action Links
  35. SharePoint: Extending the DVWP – Part 35: Putting it All Together
  36. SharePoint: Extending the DVWP – Bonus: Fixing the Insert Form Action When "No Matching Items"
 

Please Join the Discussion

8 Responses to “SharePoint: Extending the DVWP – Part 15: User-Managed Dropdowns with Site Columns”
  1. kevin says:

    How is this article related to DVWP??

    • Dear Kevin,

      This and the next 3-4 articles are not unique to the DVWP, but they will culminate in being used on the Edit Template of a DVWP.

      Since cascading dropdowns haven’t been covered extensively on EUSP, I needed to include these steps so that later ones would make sense.

      Hope that helps.

      Blessings,
      Jim Bob

  2. Nathan Wells says:

    Seems a bit bizarre to do a step-by-step walkthrough of how to create a site column when the previous two articles have been detailing how to customise pre-save actions on form action workflows. Anybody capable of following article 14 would surely know how to do this already. I’ll stick with it though, it will probably go somewhere useful.

  3. George W says:

    I’m sticking with it, but I wonder what do States and Countries have to do with Department?

    Shouldn’t you populate the Department list with names of Departments?

    • Oops! So much for abstracting the concept. ;)

      Yes, I’m using this with Departments, but my department names and locations won’t be familiar enough to readers to make the hierarchy obvious. Which is why I switched to States and Countries for demonstration purposes. Should have made the graphics consistent. ;)

      Blessings,
      Jim Bob

Trackbacks

Check out what others are saying about this post...
  1. [...] you’ve been following along as we’ve created site columns, loaded the column data, created a relationship list, and loaded the relationship lists. But you [...]

  2. [...] make data entry and modifications easier for the user, we’ll set up some site columns, load them with data, and create relationship lists between the site columns (and load those one of [...]




Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!