Custom property formatter on form

I’ve a Form where an property of source Item need to be formatter by an custom format.

Source property (of my own bean) is a Integer, but need to be formatted as a Currency-like format.

I tried to implement my own
, and setup it inside my
for this form as

TextField tf = new TextField("Price");
Property original = item.getItemProperty("price");
tf.setPropertyDataSource(new MyPriceFormatter(original));
return tf;

But as I see from the logs, only
method is called. But
method is never used,
is never called

What’s wrong with my code? How to use custom
for forms? Or how to add custom format for form’s field?

asked also at SO:

Value doesn’t propagate to datasource on value change unless you commit or set that textfield to writethrough mode.

This has come up before as well: the values of Form fields are set when calling Form.setItemDataSource()
the field is created by the field factory. Therefore, the later setPropertyDataSource() replaces the data source you set in the field factory.

You could e.g. use FieldWrapper in the
CustomField add-on
to do the conversions.