You are viewing limited content. For full access, please sign in.

Question

Question

Forms 10.2 Unexpected Error after submission with JavaScript

asked on March 23, 2017

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)

0 0

Replies

replied on March 23, 2017

Check ever single variable in the variable pane to make sure that they actually have variable names and not blank.

0 0
replied on March 23, 2017

Hi Michael,

To test whether it is truly the custom JavaScript which is causing the issue, you can try commenting out the entire block and testing whether a submission can go through (though of course any modifications from the script would not be applied).

If it does turn out that the script is causing errors, you can try adding alert( ... ) statements between each of the actions that are hooked into the onSubmit event, to narrow down which part exactly is responsible. There were changes in Forms 10.2 to the way in which custom JavaScript is executed, but narrowing down what kind of statement could be causing this would go a long way.

Hope this helps!

0 0
replied on March 23, 2017

Please check whether you use a customized Submit button to submit the form instead of original Forms Submit button. The request for Submit button is changed in Forms 10.2, it may related to some data was missing when you use you customized Submit button to submit.  Please check whether your request contains these "PreventChromeAutocomplete=&HiddenFieldIgnore=&HiddenContainerIgnore=&".

0 0
replied on March 24, 2017

Those query parameters are included.  The submit button itself isn't customized.  I am adding a new Click event handler to the button which will fire before the default event.  This will then prevent the form from submitting.  After my process is done, I add a CSS class to the Form tag and invoke the "submit" event on the Submit button to submit the form.

SubmissionFormatted.PNG
SubmissionQuery.PNG
0 0
replied on March 27, 2017

You Form Data is missing the "action" part, see following one as the correct one:

0 0
replied on July 25, 2017

I am having the same issue in Forms 10.2.1. What do I need to do please to add the action part?

 

Thanks

Priya

0 0
replied on July 31, 2017

I had to have the JavaScript actually click the button again.  Submitting the form using jQuery didn't work, that causes the missing action.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.