Forms no longer saving

Hi,

for whatever reason, all the forms on my website stopped workin (they were working just fine until last night - I received a submission at 544PM).
Now, I am getting this error message in the inspector:

save operation failed: 
t {code: "DS_VALIDATION_ERROR", message: "Some of the elements validation failed", name: "DatasetError", stack: "DatasetError: Some of the elements validation fail…ervices/dbsm-viewer-app/1.1098.0/app.js:6:164381)", Symbol(error-boundary-scope): "userCodeZone", …}
code: "DS_VALIDATION_ERROR"
Symbol(error was handled): true
Symbol(error-boundary-scope): "userCodeZone"
message: "Some of the elements validation failed"
name: "DatasetError"
stack: "DatasetError: Some of the elements validation failed↵    at N (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:165544)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:168984)↵    at u (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:130745)↵    at Generator.eval [as _invoke] (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:130498)↵    at Generator.forEach.t.<computed> [as next] (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:131102)↵    at n (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:164287)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:164426)↵    at new Promise (<anonymous>)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:164224)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:169199)↵    at Object.fold (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:30796)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:168774)↵    at u (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:130745)↵    at Generator.eval [as _invoke] (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:130498)↵    at Generator.forEach.t.<computed> [as next] (https://static.parastorage.com/services/pro-gallery-santa-wrapper/1.1078.0/viewerScript.bundle.min.js:1:131102)↵    at n (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:164287)↵    at eval (https://static.parastorage.com/services/dbsm-viewer-app/1.1098.0/app.js:6:164381)"
__proto__: t

e.<computed>@ua-parser.js:1r.error@index.js:4eval@index.js:4errorReporter@app.js:1eval@index.js:4u@viewerScript.bundle.min.js:1eval@viewerScript.bundle.min.js:1forEach.t.<computed>@viewerScript.bundle.min.js:1n@index.js:4eval@index.js:4Promise.then (async)n@index.js:4eval@index.js:4eval@index.js:4postMessage_onMessage@ua-parser.js:1value@ua-parser.js:1delegateMessageToSDK@bolt-worker.js:1(anonymous)@bolt-worker.js:1u@viewerScript.bundle.min.js:1eval@viewerScript.bundle.min.js:1forEach.t.<computed>@viewerScript.bundle.min.js:1asyncGeneratorStep@bolt-worker.js:1_next@bolt-worker.js:1(anonymous)@bolt-worker.js:1_processMessage@bolt-worker.js:1(anonymous)@bolt-worker.js:1handle@ua-parser.js:1(anonymous)@bolt-worker.js:1self.onmessage@bolt-worker.js:1

I even went into the history to see if the previous versions would work, but no dice.
The website is:
https://www.nextlvlrealty.com/

I haven’t changed any of the mappings :frowning:

I just started a marketing campaign last night, and now none of my leads can submit my forms.
I also tried to call Wix support - was put on hold for an hour, and the call was disconnected.

HELPPP!!!

If you made no changes to your code, then this is really a system issue. You should reach out to Wix Customer Care .

Still no resolution, and impossible to get a hold a hold of a technical resource :frowning:
This is my first time on Wix. So far, it’s a really frustrating experience.
Does anybody have any recommendations on how to easily get a hold of a knowledgeable tech person, or get update?

If you go to your site and simply click on the submit button without entering anything, your form will have the red error frames around it and you will get the same error message in the console log.

Therefore, as it is stating Dataset Error as well, I would suggest that you go back and check everything over on your website.

Check that your dataset field types are the same as the user inputs used on your form, so for example, have you got a number field type in your dataset and a text field in your user inputs?

Like your telephone number input, have you got that set as number or text in your dataset, as note that in Wix CRM API, the Contact Info has phones stored as a string in an array, so if you are trying to add a phone number like 111-111 you can’t use number field in your dataset.
https://www.wix.com/corvid/reference/wix-crm.html#ContactInfo
phones : Array < string >

You have set it up as tel, which is correct with the user input, however like I have just stated above, you can’t use dashes in it as that would be classed as string and not number and note that with type: tel, if not supported in some browsers it therefore resorts back to string.
https://www.w3schools.com/tags/att_input_type_tel.asp

If you wanted to have dashes put into the number then you would need to look at adding a regex pattern along with your existing code. For example, here is the pattern for a common USA phone format: [+]\d{2}[(]\d{2}[)]\d{4}[-]\d{4}

So make sure that your user input field types match up exactly with your dataset field types, otherwise you will get a validation failed error. This can mostly be the route cause of something like this.

Also, double check your code and make sure that it is setup correctly as well. There are examples that you can use from Wix to check through your code, along with the ValidatableMixin API itself.
https://www.wix.com/corvid/example/custom-validations
https://support.wix.com/en/article/corvid-about-validating-user-input-with-code
https://support.wix.com/en/article/working-with-user-input-validation-in-the-settings-panel
https://www.wix.com/corvid/reference/$w.ValidatableMixin.html

It is also a good idea to post up - in a code block - your used code for this page, so that it can be checked over and see if there is any error in it.

However, as Yisrael has stated in his reply, if it has been working for a good while and you have not changed anything and it has suddenly stopped working, then it could be a systems error and you would need to be going through Wix Support for that to be fixed.

You have a hidden field #source that you have set to be a required field. When I tested the form, the field is empty. Since it’s required , and it’s empty , the validation fails and the record doesn’t save. You should change this field to be not required .

THANK YOU!!! That fixed it. I don’t know what changed, because that was in there and working before.

One issue am seeing now, is in the SendGrid integration, where one of the variable in the sendgrid template isn’t replaced.

Here’s what the template looks like in SendGrid (referred to as " [SendGrid Template ID 2 - for internal] " in the second code snippet):

First Name: {{firstName}}
Last Name: {{lastName}}
Email Address: {{email}}
Phone Number: {{phoneNumber}}
Property address: {{propertyAddress}}

Here’s the code I have in data.js to send the emails (via hook). I send an email to the person who sent the form, and one internal to notify me

// User facing email
const msg = {
  to: item.emailAddress,
 from: 'my address',
  templateId: '[SendGrid Template ID 1 - for user facing]',
  dynamic_template_data: {
    firstName: item.firstName,
    propertyAddress: item.propertyAddress.formatted,
  },
};

// Internal email
const IntMsg = {
  to: '[my address]',
 from: '[my address]',
  templateId: '[SendGrid Template ID 2 - for internal]',
  dynamic_template_data: {
    firstName: item.firstName,
    lastName: item.lastName,
    email: item.emailAddress,
    phoneNumber: item.phoneNumber,
    propertyAddress: item.propertyAddress.formatted,
  },
};
sgMail.send(msg);
sgMail.send(IntMsg);
}

But when I receive the internal email, I see this, where for some reason, the email variable isn’t replaced - I know “item.emailAddress” works, since I receive the user facing email. Any idea what I might be doing wrong?

First Name: Test
Last Name: Sendgrid
Email Address: {{email}}
Phone Number: (123) 123-1234
Property address: 50 Laguna St, San Francisco, CA 94102, USA
1 Like

Here’s your internal email msg:

const IntMsg = {
  to: 'hang@nextlvlrealty.com',
 from: 'hang@nextlvlrealty.com',
  templateId: 'd-f8d7b92ccd244662b29d33fa65f858bb',
  dynamic_template_data: {
    company: item.company, 
    specialization: item.specialization, 
    firstName: item.firstName,
    lastName: item.lastName,
    email: item.email,
    phoneNumber: item.phone,
  },
};
sgMail.send(msg);
sgMail.send(IntMsg);
}

You have email: item.email - shouldn’t it be email: item.emailAddress ?

Other than that, I can’t really say.

I have email notifications for each forms, which are all writing to a different content manager.

Because of how I initially setup the contractors table, the email field key for that one is named “email”, which is what the code snippet you showed was for:

For the other content managers, the field key for the email field is named “emailAddress”:

I would prefer if I could standardize the names, but I can’t find a way to do it.
Also no sure why the variable isn’t replaced

I suspect your problem has something to do with your Sendgrid configuratin or your template. You should check your template and make sure that you are using the correct field names.

Other than that, I’m sorry but I really don’t know what could be the problem.

Maybe some users who have experience with Sendgrid can suggest something.

To add further to Yisrael’s replies back to you…

If you are not using that extra user input with the id name of #source, then it would be best to just delete it from your page.

However, if you are using it as a read only user input to put something in that is saved along with the users own inputs, then yes put that as Yisrael has stated.

As for the SendGrid emails itself, you have talked to @salman-hammed previously on an old forum post about this here.
https://www.wix.com/corvid/forum/community-discussion/ned-help-with-email-using-sendgrid

For which he has linked you to his tutorial on @code-queen Totally Codable website, of which he is a partner of.
https://support.totallycodable.com/en/article/send-email-notification-using-sendgrid-npm-and-wix-code

Also, note that both of them are both Corvid Masters here and will reply to you when they have the chance and time depending on their own work schedules etc, so you can always see if they reply back to you directly as well.

With the tutorial that is used, it is always using the field name of Email and the field key of email, therefore everything in the Wix Code and SendGrid code will relate to that email field.

So, where you have stated…
Because of how I initially setup the contractors table, the email field key for that one is named “email”, which is what the code snippet you showed was for.
For the other content managers, the field key for the email field is named “emailAddress”:

You have actually used two different field names and you will have the two different field keys too.
Email - email;
Email Address - emailAddress.

Therefore, if you want to use your current setup, you are going to need to create two different sets of code to be used here.

One for the forms and datasets that use the Email Address (emailAddress) field name and key, along with another set of code for the form and dataset that uses the Email (email) field name and key.

You can’t run forms that connect to different dataset fields through the same code as your code only contains the one field name and key.

As Salman had mentioned to you at the end of the previous forum post that was linked above.

The form should connected to the Database 
If that database has a new Entry then 
"AfterInsert" hook will be triggered with the "item" object containing the value of the NEW entry 

So the "item" will be like this 
item = {
"title" : "Salman",
"email" : "salmanhammed77@gmail.com",
"phone" : 12345678,
"detail" : "This is a message!"
"fieldKey" : "fieldValue"
}
let say you have a field with a fieldKey of "phone" then
EXAMPLE:
     dynamic_template_data: { 
      name: item.title,
       email: item.email,
       detail: item.detail,
       phone: item.phone,
 }  

So, as Yisrael has pointed out in his replies to you earlier, if you have the field name of Email Address then you should be using different code with the correct field key of emailAddress.

Using Salman’s example again with the email changed for Email Address field instead of Email.

The form should connected to the Database 
If that database has a new Entry then 

"AfterInsert" hook will be triggered with the "item" object containing the value of the NEW entry 

So the "item" will be like this 
item = {
"title" : "Salman",
"email" : "salmanhammed77@gmail.com",
"phone" : 12345678,
"detail" : "This is a message!"
"fieldKey" : "fieldValue"
}
let say you have a field with a fieldKey of "phone" then
EXAMPLE:
     dynamic_template_data: { 
      name: item.title,
       email: item.emailAddress,
       detail: item.detail,
       phone: item.phone,
 } 

Finally, with regards to this comment…
I would prefer if I could standardize the names, but I can’t find a way to do it.
Also no sure why the variable isn’t replaced

Have you just tried exporting the dataset as a csv file and then creating a new dataset with the field email and simply importing the csv file back into this dataset.

Obviously switching the Email Address field so that it links/matches to the Email field instead.

I would do this on the option where there is the least number of data which uses either the Email field or the Email Address field.

If the dataset with the Email field only has say 100 entries, whereas the dataset with the Email Address field has say 200 entires, then simply use the first one as there is less user data to work with.

Hi, @yisrael-wix response helped solve all the problems.
For others who might benefit from this:

  • The reason the forms were not submitting was because the hidden field was flagged as required. I am almost positive that it was already setup that way, since I was able to receive form submissions, but that’s what was causing the issue.

  • The variable not being replaced in the emails I receive was an issue on the sendgrid side. I had to manually retype the template (same visible values, so am assuming that was due to some invisible character / bug in Sendgrid)

  • I ended up standardizing the field keys by deleting the old ones. I cold do that because the website was still new, so I could manually update values.
    Thanks for the responses.

1 Like