will an empty input field override the current database value

if any of the input is empty will it override the current value in the database?
10 Replies
cje
cje3y ago
empty string yes undefined no
Lopen
LopenOP3y ago
Any Possible solutions without using if statements?
cje
cje3y ago
...(someVar && {somevar})
Lopen
LopenOP3y ago
Am lost Conditions?
cje
cje3y ago
data: {
...(something && {something}),
...(anotherThing && {anotherThing}),
}
data: {
...(something && {something}),
...(anotherThing && {anotherThing}),
}
you can put as many of these as you want if the variable is nullish, it evaluates to nothing
Lopen
LopenOP3y ago
Oh nice I will use
something.lenght >0 &&
something.lenght >0 &&
Just to be safe Is that okay?
cje
cje3y ago
sure but unecessary "" == false
Lopen
LopenOP3y ago
What of in a case of numbers Where default is
0
0
cje
cje3y ago
there's no such thing as an empty number 0 is nullish but you were asking about empty input
Lopen
LopenOP3y ago
This approach seems i have to make the field in the database nullable

Did you find this page helpful?