Question

I've ran into a problem when trying to create custom new item forms for a list that has multiple content types. I've tried inserting a custom list form for a content type (this content type isn't the default) and I'm shown all fields for every content type. This only happens when I choose a custom list form for a content type that isn't default. So, I'm left with thinking, I should create the link to the new item form with a query string that auto-populates the content type and then only display the correct fields for each different content type. Seems a little hackery, so I'd like to know what everyone else thinks about what I'm running into.

Thanks, Matt B.

Was it helpful?

Solution 2

The definitive answer is "Always check google!" After troubleshooting the lists/custom pages and realizing they weren't the problem. I had to look inward. Yep, I did a simple google search of my error message:

http://www.google.com/search?q=The+data+source+control+failed+to+execute+the+insert+command.&sourceid=ie7&rls=com.microsoft:en-us:IE-SearchBox&ie=&oe=

One of the first links that I saw was:

http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/1eae652f-2c7b-4a72-a06f-5cfeffce19bd

Checking the dates of the post, I thought that this info was a bit too old for my environment... I already had SP1 installed... Come to find out, I wasn't running on a fully updated farm. I was running on the version: 12.0.0.6300 Apparently that wasn't good enough. After helping @givenscj some help with a BSOD, I asked him about my version and he recommended upgrading to at least SP2. I immediately took his advice and now my data source insert problem has gone away.

Cheers to Friday!, Matt

OTHER TIPS

When you customize the form (effectively converting the LFWP to a DVWP), you lose the automagic-ness of the LFWP. As you know, the LFWP understands all of the Content Types and adjusts itself according to which Content Type you have chosen. That "understanding" goes away with the DVWP.

The solution, though it may not be the solution which you want, is to create a custom form per Content Type. You'll notice that on the Supporting Files tab of the List Properties in SharePoint Designer, you can set a form per Content Type. That's why!

Your approach on this may differ based on how many Content Types you are dealing with. You can either have one form with script to manage column visibility or one form per Content Type (or some combination).

If the only reason you're using a customized form is to populate columns from the Query String, then I'd just add some script without going with DVWPs.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top