I am having trouble opening a web enabled form after adding some custom code to it. The code works fine when I preview the form in design mode but once I try and open the form on SharePoint I am prompted with an error. I am uploading this form as a Site Content Type in the Publishing Wizard. The fields in the form are closely tied to a content type so I don't know if that has something to do with it. If I remove the custom code than the form opens in SharePoint without a problem. I've even tried just some very basic custom code (a button that prompts a popup box containing a value one of the fields in the form) but still getting the issue. If more information is needed please let me know and I'll answer everything to the best of my ability.
I am using both InfoPath 2010 and SharePoint 2010
Also I am very interested in learning to use some of the more advanced features in InfoPath. Could someone point me into the direction of some good tutorials or books. I have done a fair amount of Google but would appreciate some recommendations.