Value says "Null" within a form submission email???

Hello,

Wondering if anyone can help…

I’ve recently created a custom form on Wix that has been successfully connected to a datebase and SendGrid.

However, when I completed, submitted and received the form via email the datepicker value says “Null”.

Why is this and how do I fix this?

Null can simply mean that there is no value in that field, have you got the datepicker field type setup correctly in the dataset and in your code? Have you used the field key and not just the field name? Did you actually select a date from the date picker when you tested your form?

Hello and thank you for your message!

have you got the datepicker field type setup correctly in the dataset - Yes.

code - not sure. What should it say?

Have you used the field key and not just the field name? - Where would I use this?

Did you actually select a date from the date picker when you tested your form? - Yes.

@callumsaffet

Assuming you are using this tutorial, then you don’t need to worry about using field names or field keys in this code here.
https://support.wix.com/en/article/corvid-tutorial-sending-an-email-on-form-submission

However, you will need to make sure that the date picker id name is correct where you add it to the page code in this part of your code from the tutorial.

function sendFormData() {
const subject = `New Submission from ${$w("#nameInput").value}`;
const body = `Name: ${$w("#nameInput").value}
  \rEmail: ${$w("#emailInput").value}
  \rSport: ${$w("#sportDropdown").value}
  \rComments: ${$w("#commentsInput").value}`;
const recipient = $w("#emailInput").value;

Make sure that if your date picker element has an id name of #datePicker then you use that.

Also, with the triggered email that you have also setup to be sent through this Sendgrid tutorial, make sure that you have the date picker variable contained in that triggered email too.

@givemeawhisky

Yes, the datepicker variable is contained within the triggered email and the ID is correct.

I changed the datepicker input field from Placeholder text to Today’s date . However, when I completed, submitted and received the form via email again, it only showed Today’s date , rather than the new date I had chosen.

So you’re aware, I have created my custom form on a slideshow with a “Back” and “Next” button and have noticed that when I select a date within datepicker, continue with form and then select “Back” to return to the datepicker, the chosen date disappears - I think this is why I am experiencing the above. However, how do I fix this?