I have a custom list which contains a section of checkboxes on the NewForm that looks like this:


What I want to do is be able to modifiy the list of checkboxes and group certain choices together under headings. So it may look something like this:


I would really like to use C# to modify this dynamically that way I can easily handle changes to the list of choices. Is there any way I can do this?


Custom Field Types

Custom Field Type is an obvious solution, and I believe it is the officially supposed one (that's why I upvoted the Robert Kaucher's answer), however it has some very important drawbacks, which deserve mentioning here. I can recall at least these two:

  1. Custom Field Types are readonly in Access View.
  2. Custom Field Types are readonly in DIP (Document Information Panel, so when you create MS Office Documents you will not able to assign any values to your custom field from there).

And I know there are some other inconveniences, limitations and bugs, related to the Custom Field Types. Also, they involve quite a big amount of development effort, and the more code you write - the more you have to maintain, and the more places there are for bugs to hide :)

And yes, Custom Field Types are not available in Sandbox and Office365.

Actually, as of late (ok, actually for almost 2 years already), I tend to avoid using Custom Field Types unless they're absolutely necessary.

The other option

For your situation, I would recommend to consider a simple JavaScript/jQuery approach. I.e. after a page loads, your javascript finds all the checkboxes, splits them into groups based on their values, and wraps the groups into appropriate html markup.

I have to admit, this is a fragile solution. For example, each time somebody changes values of checkboxes or adds/removes a value, you have to fix your script to reflect these changes. But jQuery solution takes much less effort to implement, than Custom Field Types, and also has some advantages, thus I reckon this option deserves at least considering.

For example, if the set of checkboxes is fixed and never changes, or if you can garantee that responsible persons will use some particular format (i.e. "Category: Variant") when they add/modify the variants for the field, then this solution looks quite acceptable.

There are several helper javascript libraries which can help you with the implementation, for example, there is SPUtility.js open source project by Kit Menke.

I think, having some time, I can provide an example myself, if you need it.

  • Is it acceptable to use js/jquery when developing with SP? I'm fairly new to SP but using js doesn't really seem like "the SP way" of doing things. I just wasn't sure if there was a more proper way of doing this using VS and C# – MattL922 Jun 7 '12 at 16:37
  • Generally, Javascript is absolutely OK to use with SharePoint. For example, they have JavaScript Client Object Model for accessing SharePoint objects from JS. Besides, I hardly can imagine a modern browser application which doesn't use JS :) What about "the SharePoint way", I don't think I have to add anything to my reasoning above. Custom Field Types are more official, but have some HUGE cons. JS approach is less official and have cons too, so what I myself would use - heavily depends on the particular circumstances. – Andrey Markeev Jun 7 '12 at 18:22
  • I tried making a custom field type using the tutorial Robert gave, which seems like a nice tutorial, but I couldn't get it working. Javascript seems much simpler so I'm going to go that route. – MattL922 Jun 8 '12 at 12:05

You will need to develop a custom field type for your list. Here is a tutorial that explains how to do that. http://msdn.microsoft.com/en-us/magazine/dd727508.aspx

  • I'll take a look at this and see if I can get it working. – MattL922 Jun 7 '12 at 13:48
  • I walked through this tutorial and couldn't get my custom field type to show up in the list. I didn't use stsdev like the author suggested so I don't know if that had anything to do with it or not. – MattL922 Jun 7 '12 at 16:33

Rendering Templates

You could use rendering templates if you can create a farm solution. Rendering templates allow you to change up the listforms as you see fit. But you have to be able to save markup to the file system so it's not for everyone. Javascript manipulation is prefectly OK. Now that solutions are sandboxed and run on Office 360, its the only way to customize forms -- unless you want to use InfoPath forms with Designer ugh!


  • Rendering templates are a good way to go, especially if you want to arrange fields into tabs or sections, or something like this. But rendering templates don't bring any advantages when we are trying to modify something inside a field control. This particular question corresponds exactly this scenario, thus I don't think the answer is appropriate. – Andrey Markeev Jun 7 '12 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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