I have a form with some custom JavaScript. The JavaScript worked fine in Forms 9.1 to 10.1, but in version 10.2.0.834, the JavaScript is causing Forms to error upon submission with "[LFF502-UnexpectedError]" (full error below). The inner exception is a NullReferenceException and the error message looks a lot like the error with Date fields. There are not any date fields on the form and the latest hotfix has been applied.
I'm not able to post the full JavaScript, but it loads an external script, hooks into the Submit button click, displays a jQuery dialog, and adds a CSS class to the form when the dialog is closed.
Once the form is submitted, the error displays right away (the form submission page does not display) and the Forms Process is not started (nothing shows up under Instances in Progress under Metrics). Is there a way to prevent JavaScript from running unless the form is displayed in the browser or is there a way to troubleshoot the JavaScript after the form is submitted?
Full error from event viewer:
An unexpected error has occurred. [LFF502-UnexpectedError]
Details:
URL: /Forms/Form/Submit
Error: UnexpectedError
Date: 3/23/2017 12:35:02 PM (Pacific Standard Time)
HTTP Status Code: 500
Business Process ID: 0
User: ADMIN
IP: 192.168.111.243
Browser: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Business Process Name:
Stack Trace:
Caught exception: Laserfiche.Forms.CommonUtils.Exceptions.LFFormsException
Message: An unexpected error has occurred. [LFF502-UnexpectedError]
Inner exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
at E_Forms.Controllers.FormController.Submit(FormCollection collection)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)