So, at this point my form does render on the page and the field validation works and the form submits via AJAX to my HandleFormAjax() action. However, inside that action at the line HandleForm(model); I get the following error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Umbraco.Forms.Core
StackTrace:
at Umbraco.Forms.Core.Services.WorkflowService.GetPageElements()
at Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List`1 workflows, RecordEventArgs e)
at Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(Record record, Form form, FormState state, Boolean editMode)
at Umbraco.Forms.Core.Services.RecordService.Submit(Record record, Form form)
at Umbraco.Forms.Web.Controllers.UmbracoFormsController.SubmitForm(Form form, FormViewModel model, Dictionary`2 state, ControllerContext context)
at Umbraco.Forms.Web.Controllers.UmbracoFormsController.GoForward(Form form, FormViewModel model, Dictionary`2 state)
at Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel model)
at myProject.Controllers.UmbracoFormsAjaxController.HandleFormAjax(FormViewModel model, Int32 currentPageId) in C:\temp_source\projectfolder\mySolution\myProject\Controllers\UmbracoFormsAjaxController.cs:line 73
Something is blowing up inside of WorkflowService.GetPageElements() and I'm guessing that "Page" refers to the current Umbraco page. And, of course, since this process was kicked off by an AJAX call there is no current Umbraco page (as far as the process is aware).
In UmbracoFormsAjaxController we're setting the CurrentPage property when the form makes the AJAX call but apparently that's not enough?? I have looked around at the other properties available to me and I don't see anything further I can do.
I'm hoping that someone else might have an idea?
BTW; just to re-iterate. The whole reason I'm doing this is so that Umbraco Forms will work on pages that are being Output Cached. Yes, I build all my widgets on my pages so that render time is at a minimum, but Output Caching still greatly improves the responsiveness of the site and so I'm loath to just turn it off.
Using Umbraco Forms shouldn't be a choice between Output Caching or Forms. They should both work together.
Does anyone have an ideas where I can go from here?
Converting Umbraco Forms to be an AJAX form
Hi,
This was originally a reply on an old thread in a now-archived forum: https://our.umbraco.com/forum/umbraco-pro/contour/60788-Umbraco-Forms-and-Ajax ... I'm reposting it here so it'll get more visibility.
Essentially, the old thread was a discussion on how to convert Umbraco Forms to use an AJAX form. I ran into a problem deep inside UF and am stuck ...
I'm trying this in Umbraco 8 and I am getting an error that I don't know how to resolve. First, my code:
My controller:
Here's my customer Render.cshtml in my theme directory:
Then, my partial that calls the RenderMacro helper:
So, at this point my form does render on the page and the field validation works and the form submits via AJAX to my HandleFormAjax() action. However, inside that action at the line HandleForm(model); I get the following error:
Something is blowing up inside of WorkflowService.GetPageElements() and I'm guessing that "Page" refers to the current Umbraco page. And, of course, since this process was kicked off by an AJAX call there is no current Umbraco page (as far as the process is aware).
In UmbracoFormsAjaxController we're setting the CurrentPage property when the form makes the AJAX call but apparently that's not enough?? I have looked around at the other properties available to me and I don't see anything further I can do.
I'm hoping that someone else might have an idea?
BTW; just to re-iterate. The whole reason I'm doing this is so that Umbraco Forms will work on pages that are being Output Cached. Yes, I build all my widgets on my pages so that render time is at a minimum, but Output Caching still greatly improves the responsiveness of the site and so I'm loath to just turn it off.
Using Umbraco Forms shouldn't be a choice between Output Caching or Forms. They should both work together.
Does anyone have an ideas where I can go from here?
Thanks!
Ugh, I want this to appear in the Umbraco-Forms forum. Why can't I pick the forum when creating a new topic!?
is working on a reply...