How to show read-only property with 0 as default?

Faced with issue :
I can’t setup as default float property with 0 (If not 0 - is correct)


I would suggest make the field type currency.

Oh with the Currency is the same problem



What about using JavaScript? On the refresh event you can set the value to zero.

Hi, so far I think it’s like that if its 0 or empty. I would suggest having a custom field type Data so it will be a string, if its string then 0 won’t be considered as empty. But for your processes you will sill use the currency field.

Could you please give me example - how to set default with JS

Hi I would not suggest doing it in JS, because it will make the document unsaved (if the document is already submitted)

Oh ok ok i will use currency type
But is not user friendly interface - to have empty fields. And I am worry about this…

To see:
Rate: $ 0

  • is much better then

Rate


:frowning: :joy:

Yea that’s why I’m suggesting having an extra field for display which is of type Data. Data is somehow a string, so even if its 0 it will not be considered as NULL

Yes, of course.

With that script it will validate that only when there is a new document the value is set to zero. So, you won’t have to worry about the unsaved message.

Two things:
1st. Doctype Name will be replaced by the real doctype’s name that you are working on.
2nd. Fieldname will be replaced by the real fieldname that you want to be set to zero.

And sorry for the delay! :wink:

1 Like