You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nazeem <md...@gmail.com> on 2014/02/22 15:18:14 UTC

double type text field - auto roundsoff

Hi I am having an issue with the Double text field which when keyed in for
eg, 604.43 rounds of to 604. I am using the txField.add(new
AjaxFormComponentUpdatingBehavior("onblur") { .. } . Inside this im doing
validations, if error or no error I am repaining the text field. When
repainting it the values changes from 604.43 to 604. During the on blur
event i get the value correctly.. But after the method completes and
repainted the value is changed to 604. How to trouble shoot this ? 

Regards
Naz

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by Sven Meier <sv...@meiers.net>.
Are you using HTML5's type="number"?

Sven

On 02/24/2014 02:43 PM, nazeem wrote:
> Today i noticed the same behaviour in another text field of type double. But
> on refresh the issue was not repeating. So.. any clue to trouble shoot this
> issue in this form ? where it is consistently reproduced.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664650.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by nazeem <md...@gmail.com>.
No i don't have any initialised. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664714.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by francois meillet <fr...@gmail.com>.
Is there any specific DoubleConverter initialized in the Application's
newConverterLocator() method ?

François


On Wed, Feb 26, 2014 at 5:55 PM, nazeem <md...@gmail.com> wrote:

> Changing the object type to Big Decimal solves this .. Still not clear
> how..
> if any body knows any clue please let me know..
>
>
> TextField<BigDecimal> ....
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664701.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: double type text field - auto roundsoff

Posted by nazeem <md...@gmail.com>.
Changing the object type to Big Decimal solves this .. Still not clear how..
if any body knows any clue please let me know.. 


TextField<BigDecimal> .... 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664701.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by nazeem <md...@gmail.com>.
Here is the generated html

<input type="text" id="txInput209"
name="forceForm_body:plannedQty:txfCntr:txInput" value="1" class="full-width
">

On inspecting the DOM i see the set range text property set to ....
setRangeText : setRangeText() 

If i remove the on blur event , the value remains as decimal, but I can't do
validations without onBlur. 




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664659.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

What type attribute do you use for the <input> ?
Maybe the rounding happens at the client side.

Martin Grigorov
Wicket Training and Consulting


On Mon, Feb 24, 2014 at 3:43 PM, nazeem <md...@gmail.com> wrote:

> Today i noticed the same behaviour in another text field of type double.
> But
> on refresh the issue was not repeating. So.. any clue to trouble shoot this
> issue in this form ? where it is consistently reproduced.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664650.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: double type text field - auto roundsoff

Posted by nazeem <md...@gmail.com>.
Today i noticed the same behaviour in another text field of type double. But
on refresh the issue was not repeating. So.. any clue to trouble shoot this
issue in this form ? where it is consistently reproduced.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664650.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by nazeem <md...@gmail.com>.
Hi Sven,

I had used in other places, this is not the case. it works perfectly fine. 

I had tried that break point approach as well before posting, my setter is
called with correct value. Only after the refresh or repaint in onBlur.. the
value changes in the form itselfto 604. Now when i hit submit the setter is
called with 604, because that is what is in field value. But during refresh
how it turns from decimal value to 604 ? that s what im not able to trouble
shoot.

Thank u for ur time. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628p4664631.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: double type text field - auto roundsoff

Posted by Sven Meier <sv...@meiers.net>.
Hi,

check FormInput from wicket-examples, it has a TextField<Double> and 
happily accepts 604.43 without rounding.

 >How to trouble shoot this ?

Put a breakpoint into your model object's setter and check where the 
value is coming from.

Sven

On 02/22/2014 03:18 PM, nazeem wrote:
> Hi I am having an issue with the Double text field which when keyed in for
> eg, 604.43 rounds of to 604. I am using the txField.add(new
> AjaxFormComponentUpdatingBehavior("onblur") { .. } . Inside this im doing
> validations, if error or no error I am repaining the text field. When
> repainting it the values changes from 604.43 to 604. During the on blur
> event i get the value correctly.. But after the method completes and
> repainted the value is changed to 604. How to trouble shoot this ?
>
> Regards
> Naz
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/double-type-text-field-auto-roundsoff-tp4664628.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org