Error Message when Updating Database from form

I am attempting to update a table in the retool database using a form. One of the fields is called confirm_date. If a user enters a value for confirm_date, I want that value to write to the database. If no value is entered, I want null to be written to that field. I am using the following code

{{ form19.data.confirm_date == "" ? null : form19.data.confirm_date }}

Now when submitting the form, I am getting the following error message

returning * - invalid input syntax for type date: "null "

Any help would be appreciated.

Hi @tomm,
Your JS logic looks correct.

How are you updating your table?
Try
SET confirm_date = {{ form19.data.confirm_date === "" ? null : form19.data.confirm_date }}

not like this:
SET confirm_date = '{{ form19.data.confirm_date === "" ? null : form19.data.confirm_date }}'

If this doesn't work can you please send a screenshot or 2?

Hi @tomm, just checking in on this thread. Were you able to get this working?