XForm events not firing

Vote:
 
Hi, I'm experiencing a problem with XForms on one project that I've not had before. The ControlsCreated event is firing as expected but for some reason, despite the page being valid, the AfterSubmitPostedData event is not firing. The code for setting up the event is below. Has anyone ever experienced this before? Thanks, Justin private void Page_Init(object sender, System.EventArgs e) { if (CurrentPage.Property["MainXForm"].IsNull) { return; } SetupForm(); FormControl.FormDefinition = Form; FormControl.BeforeReadingPostedData += new SaveFormDataEventHandler(FormControl_BeforeReadingPostedData); FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData); FormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData); FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated); }
#12922
Mar 25, 2008 18:35
cjo
Vote:
 
Hi Justin, I had the same problem. My solution was the move code for setting up the form event to the OnInit method. Your code should look something like this: private void Page_OnInitEventArgs e) { base.OnInit(e); if (CurrentPage.Property["MainXForm"].IsNull) { return; } SetupForm(); FormControl.FormDefinition = Form; FormControl.BeforeReadingPostedData += new SaveFormDataEventHandler(FormControl_BeforeReadingPostedData); FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData); FormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData); FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated); } I hope this helps you solve your problem. Best Regards, Christian
#15094
Mar 25, 2008 18:46
Vote:
 
Hello you can get this problem when you try to send email from the form and the SMTP property not is correct /snive
#15095
Mar 25, 2008 18:46
Vote:
 

I got this problem, but it only appeared if the page to show after posting was set. If it was set, for some reason the AfterSubmitPostedData event did not fire.

#25748
Nov 04, 2008 9:49