Setting a value to NULL?

I have a form that has a hidden form field that I would like its value to be NULL. I can leave it blank and it removes any data in that field but I need the data to be entered into the database as NULL so that my filtering works as I need.

Or is there a better way to enter NULL data when a form is submitted?

You can use

{{null}}

in your server action value to produce a null. You could use a ternary or other condition to insert that.

2 Likes

Hi Brad, use the default condition to your POST variable:

$_POST.input_name.default(null)

This way, when empty the input will insert null to the database.

4 Likes

Perfect! Thank you!