2

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.

3 Answers 3

1

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.

7
  • I did notice the supporting files within the properties of the List. I don't mind building a new form for each Content Type b/c I am pre-filling info on each form using query strings. So I really need to have custom new item forms anyway. My custom form shows all fields for every content type. I plan on disabling the new button so everyone is forced to use the links provided. To give you background, I created a aspx page from scratch added a webpart zone, clicked insert, custom list form, new item form for the Tasks list. I need to to this so I can mod the form with hidden fields...
    – iOnline247
    Commented Apr 28, 2010 at 18:56
  • That's because you know jQuery... I know DVWP's hehe... I've yet to really step into that language other than going WOAH... That looks cool. How'd they do that... Oh that's right, I don't know how to use that or even make that work... I think I'm going to go with multi forms w/ different custom DVWP's. I'm sure there is a better way but this is what I know for now that will work and I'll be able to maintain it. Thanks for your guidance as always!
    – iOnline247
    Commented Apr 28, 2010 at 20:38
  • I've spent the last day or so trying to get the supporting files to work but it's flat out not working for me. I've used this feature before and know NOT to choose folder. I'm selecting the proper content type, but the change doesn't persist. Am I missing something easy?
    – iOnline247
    Commented May 6, 2010 at 19:14
  • If you're choosing the right Content Type, then I'm not sure why it wouldn't persist. Is there anything else about this situation that is different than what you've already outlined above? Commented May 6, 2010 at 19:20
  • This may have something to do with the list I'm using... I'm going to recreate it and see if I have better luck. Right now, I've scratched my custom form and built a new one from the ground up. Then added that as the new item form and nothing. It still reverts back to the NewForm.aspx page. The only thing I can think of is that the content type I'm trying to attach this page to is from a inheriting from a different site content type. But to my knowledge that really shouldn't matter, since it's all inheriting back up to Item anyway.
    – iOnline247
    Commented May 6, 2010 at 19:37
1

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

1

See this: http://blog.allyis.com/sharepoint-using-multiple-forms-in-a-single-list/

1
  • Welcome to SharePoint! While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See How to Answer for general guidelines.
    – Kit Menke
    Commented Jan 19, 2012 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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