Working with empty input components

Empty Text Inputs:

The text input component intentionally evaluates to an empty string when it isn't filled out.

Even if you attempt to set the textInput value to null, it will evaluate to ""

Say you want to check your database for null values if the textInput value is empty; you can use Javascript to do so:


vs

OR you can use a conditional for referencing null

Empty Number Inputs:

For number inputs, there is an option to have the component value evaluate to null, but this is turned off by default.

When this option is toggled off, default values of null will evaluate to 0:

If you choose to toggle on this feature, you can use .clearValue() in order to set it to null:

and it will accept null as a default:

If you attempt to use .setValue to set it to null or "", it will not update the component's value:

1 Like

Can we allow null values for text inputs as well. I would like to use form.data to submit a new record to the database but empty inputs are being sent as empty strings instead of null values.

I'd like to see this as an option on all input types.

Trying to set an empty number input but can't find an option for that.
There's no method to set allowNull true.
Using null or "" as default value, or using setValue(null)/setValue("") won't do anything but put a zero as a default value.

How can I fix that?

Screenshot 2023-11-13 094928

@mluna This is in the Validation rules section now

Screenshot 2023-11-13 at 7.04.53 AM

2 Likes

Thank you very much.

1 Like