I've started using the Doc2Form package and it's fantastic! I have a simple enquiry form that needs to include the possibility of adding an attachment and then sending that via email to my site admin. I have this working by using the upload datatype. However, I run into a problem when the user chooses not to upload a file. The upload field needs to be optional for my purposes. The error I get is as follows:
[NullReferenceException: Object reference not set to an instance of an object.] umbraco.editorControls.uploadField.Save() +4904
I am using Umbraco 4.5.2 and version 3.0 of Doc2Form. So, just to be clear... everything works perfectly if the user adds an attachment. The problem only occurs if the user doesn't upload a file.
Only thing is... I've edited this in the source code, and (as far as I know) I should uploade the Doc2Form.dll as the codebehind is inside that part... Only for the already installed Doc2Form, I can't find the DLL... You know anything about it ?
Edit : Also, when I upload the DLL, I'm getting a cache directive error on the website where I've used the Doc2Form..
It may be my lack of knowledge of pure asp.net programming... But as far as I know the .cs file is compiled into a .dll... in the .ascx is only the frontend of the code.
As soon as I upload the Doc2Form.dll I'm getting this error :
Error creating usercontrol (/usercontrols/Doc2Form/Doc2Form.ascx) The type 'BCTLLC.UmbracoExtensions.Doc2Form' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\dd3cc87c\5b22548a\App_Code.48kkonrl.DLL' or from assembly 'C:\Inetpub\vhosts\kraamzorglc.nl\httpdocs\bin\Doc2Form.DLL'. Please specify the assembly explicitly in the type name.
I can understand that its ambigious... But I''ve got no idea how to fix it...
Doc2Form empty upload field error
Hi,
I've started using the Doc2Form package and it's fantastic! I have a simple enquiry form that needs to include the possibility of adding an attachment and then sending that via email to my site admin. I have this working by using the upload datatype. However, I run into a problem when the user chooses not to upload a file. The upload field needs to be optional for my purposes. The error I get is as follows:
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.editorControls.uploadField.Save() +4904
I am using Umbraco 4.5.2 and version 3.0 of Doc2Form. So, just to be clear... everything works perfectly if the user adds an attachment. The problem only occurs if the user doesn't upload a file.
Any help is much appreciated!
I don't know why there is no changes in this package so long time.
Did you figure thos out? I have the same prblem.
probably not the best solution but I "fixed" it by putting a try/catch statement around the following command in /app_code/doc2form.ascx.cs:
try
{
df.DataEditor.Save();
}
catch { }
this allows the script to continue even when the upload field is empty.
Cheers! That should work!
Only thing is... I've edited this in the source code, and (as far as I know) I should uploade the Doc2Form.dll as the codebehind is inside that part... Only for the already installed Doc2Form, I can't find the DLL... You know anything about it ?
Edit : Also, when I upload the DLL, I'm getting a cache directive error on the website where I've used the Doc2Form..
As far as I remember I only modified the /app_code/doc2form.ascx.cs file. I didn't make any modifications to the DLL. it was some time ago however...
It may be my lack of knowledge of pure asp.net programming... But as far as I know the .cs file is compiled into a .dll... in the .ascx is only the frontend of the code.
please DO correct me if I'm wrong
Did you get this working?
Still a no... As I compile it turns the backside of the code into a .dll, if I upload it, it results into a cannot load XSLT error :(
are you sure the xslt error is related to the modified .cs file? can you tell me how you're adding the macro to your page please?
As soon as I upload the Doc2Form.dll I'm getting this error :
Error creating usercontrol (/usercontrols/Doc2Form/Doc2Form.ascx)
The type 'BCTLLC.UmbracoExtensions.Doc2Form' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\dd3cc87c\5b22548a\App_Code.48kkonrl.DLL' or from assembly 'C:\Inetpub\vhosts\kraamzorglc.nl\httpdocs\bin\Doc2Form.DLL'. Please specify the assembly explicitly in the type name.
I can understand that its ambigious... But I''ve got no idea how to fix it...
Looking back a year later where I learned much, theres simply a doc2form.ascx.cs in de app_code folder after installing.
Using Mreid's solution:
try
{
df.DataEditor.Save();
}
catch {}
this error got easily fixed.. ;)
is working on a reply...