Date error with MariaDB?

I have a problem with a site created years ago with Wappler, who now suddenly creates a problem (status of 500)
By making the debug of the insertion and updating pages of the records of a table, the error is generated by “Invalid Date Format”
Thinking was a server problem, I contacted assistance and they replied that they changed the database from MySQL to Mariadb
For this project, however, Wappler does not allow me to vary the connection in Mariadb
In the pages of the site, the dates in the database are read correctly; The problem occurs only during the insertion or update of a record
Where do I have to intervene to avoid this problem?

DB server:

Wappler Code

Error 500

So what is your database field type (date, datetime)?
What is the date (what format) you are sending to it?
What is the EXACT error message returned by the server action, it’s not visitble on your screenshot.
It’s explained how to see it here:

Database Server field Date:

Wappler file insert record

Wappler insert to database

Debig Error Message

the error message mentions a column IDFinanza which you are sending an empty string to '', when it seems to be an integer field, which does not allow empty values.

Hi Teodor
Maybe I understand where the problem is
From time to time the error message indicates an error for a field with different drop -down menu (idfinance … etc …)
I therefore discovered it is for the fact that the drop -down menus, before the database change from MySQL to Mariadb, also accepted a choice, while now they all require at least one choice
I don’t understand why since these fields include Null
I don’t know how to report these fields to normal
Do I have to intervene on the database or on the insertion page?
Thanks for your assistance

Well check how is your database setup and what values are allowed in this column.

The problem is that
If I choose an option for all fields with a drop -down menu, the insertion and update of records works correctly
But I would like it to be as before to leave the possibility of not choosing anything.

Trying to insert an empty string '' will always show this error. An empty string '' is not the same as null

So in your case, you need to use the default() formatter in the insert step for this value. It should be:

{{$_POST.IDFinanza.default(null)}}
1 Like

Thanks Teodor
now it works

Sorry Teodor
Following your suggestion I changed the fields that can also be null in the insertion action of new record
Now the insertion works correctly.

But now I still have problems with the record update action
I also changed the fields that could be null, but it doesn’t work

Marzio you should use this expression in the value field, not in the condition field:

Ok in fact I did nonsense, even if in the case of insertion it works the same
But do I also have to correct in the case of updating?
I think it is not necessary if the field is already null or chosen

But no
In the case of update it does not work with or without default Null

What doesn’t work? Can you be more detailed?

The insertion now works and as an example the idmotor field = null
I remember it is a numerical field
If I try to update the record if the Idmotore field is null (and must remain null) the update from errorSchermata 2024-03-29 alle 11.30.54

Please provide more details and the exact errors you see.

This the database option for update (IDMotore in the database is NULL)

This error debug

Well the error says you are again sending an empty string and not a null value. You need to add a default(null) there also for the IDMotore value.

I have tried several times to modify the IDMotore value in the update action as for the Insert action, but it gives me an error
{{$_POST.IDMotore.default(null)}}
Strangely, if I then go back to the action update / database options file, I see that the change has been canceled and the value has returned to {{$_POST.IDMotore}}

@Teodor

Hi Teodor
Unfortunately I can’t solve the problem for an apparent Wappler anomaly
I have two actions; “auto_insert” and “auto_update”
1-
In the “auto_insert” action I was able to change the value of the numerical fields that must accept a Null result
And in fact now the insertion page works correctly
2-
In the “auto_update” action instead I modify the values and save
But when the action reopen the changes have disappeared
I have tried several times and always presents this problem

Before

Change value and save

When reopen action