TypeError: Cannot read property 'type' of undefined is displayed in browser console after clicking Save/Submit button on a form.


Description

Users experience issues after clicking on Save/Update/Submit buttons on records in a specific form view,  and not with a few other views. It is also observed that a browser console error appears: on-Submit error 'TypeError: Cannot read property 'type' of undefined" for the administrator as well. This issue happens when the field used in one of your onSubmit Client Scripts is not present on the form view.

Cause

Check the onSubmit client scripts on the record table and evaluate the g_form APIs used in the script to see if any field used on the API is not present on form level of the affected view.

If the field does not exist on the form, then the script will not evaluate and stops the submit action for that specific view.

Resolution

Client scripts get executed on the browser. Fields used in the client script should be available on the form (can be configured via Form Layout Form Design) to evaluate the client scripts properly.
This issue can be resolved by adding the Fields (that are being used in the Client Script(s)) to the form layout.