PDA

View Full Version : Calculation of the textLength in a TextArea



bigmuzzy
26 Mar 2012, 3:04 AM
Hi,

the length of a value in a TextArea is calculated differently for IE and FF, so that the validation for the maxLength of the TextArea does not work correctly.

You can try it for the following Text (set the maxLenght property of the TextArea to 11):

Text1
Text2

The returned value in IE is Text1\r\nText2. The FF gives Text1\nText2 as value. So the textLength in IE is 12 and in FF 11, i.e. the TextArea in FF is valid and in IE is not.

Is there any way to fix this?
Thanks,
Vlad

System:
Win7
IE8
FF10
GXT 2.2.5

harun
26 Mar 2012, 4:39 AM
if I were you I will override validateValue method like following:



TextArea taAddress = new TextArea() {
@Override
protected boolean validateValue( String value)
{
boolean result = super.validateValue( value );
if ( !result ) {
return false;
}


// your solution comes here
// if you want to omit /r/n


return true;
}
};

bigmuzzy
30 Mar 2012, 5:52 AM
Of course I can override the validateValue() method. But in this case it is not so elegant. Different systems and Browsers handle line break differently. So details should be counted in my implementation.

What does the development team suggest for this? Is it possible to fix this on the GXT side?