Reputation: 11
I have a DynamicForm
with several TextItem
s that contain numeric values (euros). It's required to add a checkbox that should switch the view mode of TextItem
s from euros to thousands of euros and back (let's call it "Show in thousands" checkbox). But there is also a Submit button that should always be enabled. If the user clicks on this button, regardless of selected view mode, the value in euros (not in thousands of euros) should be saved to the server.
For example: we have TextItem
with value of 100,000,500.33
euros. Once we switched to "show in thousands" view mode, the visible value should become 100,001
. But, if we click Submit button in this mode, the initial value (100,000,500.33
) of the TextItem should be submitted to the server.
Moreover, "Show in thousands" checkbox should be checked by default.
I already tried to use FormItem.setEditorValueFormatter(FormItemValueFormatter formatter)
but it did not really worked as expected.
Could you please help me to:
TextItem
to be able to switch to/from "show in thousands" modeUpvotes: 0
Views: 324
Reputation: 8156
checkboxItem.addChangedHandler(...)
. On selection / unselection of "show in thousands".checkboxItem.setValue(true);
should work.Upvotes: 1