# Need to capture event after formatting applied on doublebox value.

526 2 2 9

I need to replicate a value entered in a doublebox to an another doublebox.

zul code:

<window title="Event Demo" border="normal">
<doublebox id="first" format="###0.0#"
onBlur="second.value = self.value" />
<doublebox id="second" />
</window>


If you enter 1.234567 in the first field and press TAB to change focus to the second field.
First doublebox has the value of "1.23". But, the second doublebox has the value of "1.2345".

It seems, the formatted value was not captured in the second doublebox. How can we achieve it?

Thanks.

delete retag edit

## 4 Replies

YamilBracho
1722 2

The format property affects as you see in the box so you do not have a format option in your second doublebox so you will see the number as it was entered.
<doublebox id="second" format="###0.0#" />

526 2 2 9

Thank you, YamilBracho :)

Yes, exactly. But, I present this for reproducing the problem. Actually I wanted to capture the value after the formatting applied in the first field.

Check the below code:

<window title="Event Demo" border="normal">
<doublebox id="first" format="###0.0#"
onBlur="second.value = self.value" />
<doublebox id="second" />
</window>

Type 12.3456 in the first field and click on the Save button. You will get 12.3456 as the first fields value! Eventhough the first field now has only 12.35 as its value.

Hence, I wanted to capture the first fields value after the formatting had been applied. Any suggestion to achieve this?

Thanks.

YamilBracho
1722 2

OK. I think you have to use getText() instead getValue(). Say:

526 2 2 9

Thank you, YamilBracho :)

first.text did the trick!

[hide preview]