-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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.
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.
The solution ? Add a format option to your second doublebox:
<doublebox id="second" format="###0.0#" />
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" /> <button label="Save" onClick='alert(first.value)' /> </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.
OK. I think you have to use getText() instead getValue(). Say:
<button label="Save" onClick='alert(first.text)' />
Thank you, YamilBracho :)
first.text did the trick!
Asked: 2009-09-23 13:21:05 +0800
Seen: 163 times
Last updated: Sep 25 '09