Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

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.

share|improve this answer
    
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 Apr 28 '10 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 Apr 28 '10 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 May 6 '10 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? –  Marc D Anderson May 6 '10 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 May 6 '10 at 19:37
show 2 more comments
up vote 1 down vote accepted

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

share|improve this answer
add comment

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

share|improve this answer
    
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 Jan 19 '12 at 16:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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