PDA

View Full Version : NumberField in EditorGridPanel maxValue validation



irinarosu
14 Aug 2009, 4:59 AM
Hello,
I have a problem when working with NumberField in EditorGridPanel. I have a NumberField like this one:

editor: new fm.NumberField({
allowNegative: false,
allowDecimals:true,
maxValue:9999999.99,
selectOnFocus:true,
allowBlank: true
})
When I type a really big number, a number bigger then the maxValue, example: 25 times 9, I receive the validation error message, but when the focus is lost, in the cell table I get a strange value, 125. The value in NumberField is "1e+25".
Thank you!

beng_06
7 Sep 2009, 3:14 AM
does anyone knows the solution to this problem? i am encountering this also.

Condor
7 Sep 2009, 3:18 AM
It's a bug in NumberField. It can't handle exponential notation (xe+y), which limits the input to max. 16 digits.

beng_06
7 Sep 2009, 3:22 AM
thanks for your quick response.

irinarosu
7 Sep 2009, 3:34 AM
Hello, I found a solution. If I use
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '10'} it works.

Condor
7 Sep 2009, 4:08 AM
Correct. And, as I mentioned earlier, you could use up to maxlength: '16' before NumberField breaks.

beng_06
7 Sep 2009, 4:26 AM
hi,

can i know what autoCreate does?

"autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '10'} "


i've tried putting it in my config but nothing happens, the input value gets truncated or converted to a exponential decimal value.

irinarosu
7 Sep 2009, 4:27 AM
Hello!
This is my header
{
header: '<bean:message bundle="nomtarifpilotaj" key="nom_tarif_pilotaj.prompt.tb_max"/>',
dataIndex:'tb_max',
width:110,
editor: new fm.NumberField({
allowNegative: false,
allowDecimals:true,
maxValue:9999999.99,
maxLength: 10, // for validation
selectOnFocus:true,
minText:'Valoarea minima este 0',
maxText:'Valoarea maxima este 9999999.99',
allowBlank: true,
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '10'}
})
}

beng_06
7 Sep 2009, 4:30 AM
thanks, ill try that.

irinarosu
7 Sep 2009, 4:35 AM
:)

Condor
7 Sep 2009, 4:56 AM
can i know what autoCreate does?

autoCreate contains the DomHelper config object that is used to create the <input> tag for the NumberField.

By specifying a maxlength attribute you can restrict the number of characters to be entered (any value less than 17 will avoid exponential notation).

beng_06
7 Sep 2009, 5:06 AM
thanks it is already working.

pavanbl
18 Nov 2012, 1:42 AM
Hi Condor,
So you mean to say that there is no way I can store Big numbers in NumberField. Can you suggest me any alternate solution for this.