Form problem with optional number field

Hello Team,

when i have in the next form json

{
    "fieldLabel": "Number",
    "fieldType": "number"
  }

as optional and i do not submit a number the default value comes out as 0.

i have not seen any other field act same way, is there are a way to avoid that?

version 121.3

Hi @kgurinov, welcome!

I think this makes sense!
For numeric fields, if you do not enter any value, it defaults to 0
For text fields, if you do not enter any value, it returns an empty string

image

Can you explain a bit more? Maybe I’m missing something..

Is there are a way to not have it output 0 if i do not enter any value and show 0 only if i set 0?

Currently if a user has an option to set a number and they will not set it will output 0 and will overwrite the current number they have on file with 0.

Same time we need to allow then to select a 0 if they want to set it 0.

There are no way for me to know if the user set a 0 or they have not select anything, so i cannot filter it to stop the values in my system to be overwritten with 0

AFAIK, no.

In that case, I think you should not use “number” as the element type,
Use a dropdown and define your options..

Cannot do that, the number field is an actually a currency field for ClickUp so the numbers can be between 0 and $1m and cents.

I hope for the new version of n8n where we can define the default value and this will be prefilled from the account number so it will not be 0 if there are something there only if the user will actualy set it to 0.

You can set a default value if you don’t want it to be 0:

You could try using a text Element Type, convert it to number and then validate the value after the user inputs it.

When it will be available for stable version the default values?