I am trying to pass empty date fields from my form as nulls. I see that this is a pretty big issue that for some reason still has not been solved. So when nothing is selected for a date field, Retool automatically turns it into an empty string. Since my database accepts only dates or nulls as a valid input, it throws errors.
I tried adding into the custom validation rules to the input
{{ etdInput3.value === " " ? null : etdInput3.value }}
However, I don't think I am able to set values in the validation box.
Then I tried adding custom JS code, which is triggered on the submit button, which on success triggers the update query to the table. This however does not change anything inside the form1 object.
I am trying to figure out a way how I can only isolate the date fields as I have over 50 keys in the form. Any help is appreciated.
if (form1.data.ata_delivery === "")
form1.data.ata_delivery = null
if (form1.data.eta_delivery === "")
form1.data.eta_delivery = null