Forms not redirecting on submission

I have been testing a webform and can see it is not redirecting once it is submitted. I am receiving the emails to say the form has processed but it just hangs at the end - https://grace-loans.treepl.co/contact-grace-loans.

Going back and checking my other live sites it is happening on all of them. What is happening here?

I’m not sure.
I can see there is a javascript error occurring:
Uncaught TypeError: Cannot read property 'length' of undefined
But not sure why or how to resolve it.

The same thing is now happening on the demo AJAX form here:
https://docs.treepl.co/demo-cs/ajax-form

Any JS wizards know what’s up?
@vlad.z has anything changed with the response message format?

Yes it seems to be an issue across every site I have running @vlad.z

Yeah, we have fixed returning property names in their native case in json response. So that’s why current js implementation that rely on lower-cased property names are stopped working. Sorry for that.
Example of json response:

{
  "Submissionid": 25,
  "Form_name": "test form",
  "Form_alias": "test_form",
  "Fields": {
    "System": {
      "Email": {
        "Id": "Email",
        "Name": "Email",
        "Value": "testt3606@gmail.com"
      }
    },
    "Custom": {
      "Message": {
        "Id": "Message",
        "Name": "message",
        "Value": "test title"
      }
    },
    "All": [
      {
        "Id": "Email",
        "Name": "Email",
        "Value": "testt3606@gmail.com"
      },
      {
        "Id": "Message",
        "Name": "message",
        "Value": "test title"
      },
    ]
  },
  "Error": 0,
  "Errormessages": [],
  "crmcontactlink": "https://vlad-z.treepl.co/admin/#/contacts/11",
  "crmformsubmissionlink": "https://vlad-z.treepl.co/admin/#/form-submissions/25"
}

Thanks @vlad.z
I managed to get this working again, however, there was a bit of confusion because the error response when the form is correct is Errormessages (title case) while when it’s incorrect it’s ErrorMessages (camel case).
Would be good to make these consistent to avoid confusion.

So for @SiroccoDigital (and others), the previous javascript, wherever there is a formResponse path (ie: formResponse.errormessages) now needs to be updated to correct case as per the JSON response, ie: formResponse.ErrorMessages.

I’ve updated the sample code here:
https://docs.treepl.co/demo-cs/ajax-form

1 Like