Why 0 cannot be an acceptable value?

Good day all,
I am working on child table in which I have field set a int.
If i go on the doctype, and try to input 0 as a value, it does not let me do that. It just erases the 0 and leave the field blank.
Same happen if I use float as field type.
For some reason, it lets you have 0% if you choose percentage as a field type.

Is there reason why 0 cannot be a value?
Is there a way around it?
I would really like to use 0 as an integer or float.

This bug on github seem related.

https://github.com/frappe/frappe/issues/5307

So indeed, if I remove the mandatory, I can enter 0 as a float or integer. If I put the field as mandatory I cannot enter 0.
Very strange!!
For sure I can not be the only one with that issue. Nobody is entering 0s? :wink:

@f_deryckel Have you sorted out this issue.

Entering 0 is not accepted if the field is mandatory and fieldtype is float.

Nope I had to deal with non-mandatory field .

This wasn’t the case a few months back, perhaps something changed? I had to make this non-mandatory then use custom validation.

Actually setting the default value to 0 would be an alternative way around this issue.

I resolved the issue by adding the following line of code:

value1 = data.value1 !== undefined ? data.value1 : 0;

1 Like

This makes more sense!

Something related to this is happening to me also. I have put a JS script to set values of another field depend on the value of some float field. Script is triggering for all values, but not triggering when type 0. Is there any solution or fix for this? :confused: :confused: :confused: It is also a Childtable form.