Incorrect integer value: '' for column

I try to save a form to a database where one field is not required.

It works fine except when I leave that input empty. Then I get this error: "Incorrect integer value: '' for column..."

That column is an integer field and Wappler is trying to insert and empty string value there, which gives the error.

How can I get arround this 'problem'?

Just add condition on insert:

In that case - value will be inserted only if variable from post is not empty.

1 Like

You can add a default of now to your Post Value. This will force a null value if there is no input value.

Screenshot 2024-09-04 at 8.27.59 AM

Note: When you add. this using the UI it adds single quotes around 'null'. You have to manually remove the single quotes.

Thanks Notum and brad for your help!

Both solutions should solve my issue.

On to the next challenge! :joy:

Note: Having a condition as the first suggestion suggests will not work on an Update Form if you clear the input as it will only update if there is a value. So if you are using ths on an update form you should use the default to null method.

1 Like

Good to know.
Thnx brad