Hi there,

    I have a TextInput type that I am using as an itemEditor in a DataGrid.  
I'm trying to prevent users from entering anything but 'dollar' amounts.  I 
have the class below, but it doesn't work as expected...  I can edit the grid 
cell, enter a letter, and then exit the grid without warning.  It's only when I 
click on the grid to edit it a second time, that the red halo with the 'invalid 
input' flag appears.  Help appreciated.


<?xml version="1.0" encoding="utf-8"?>
<mx:TextInput focusOut="validateData();" 
xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%" height="100%" 
implements="mx.core.IFactory">
<mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
import mx.controls.dataGridClasses.DataGridColumn;

public var dataField:String;
private var rowData:Object;

[Bindable]private var contentValue:String;


public function newInstance():*{
return new GenericDollarFormatItemEditor();
}

private function validateData():void{
cv.validate();
}

override public function set data(value:Object):void {
if( value != null ){
rowData = value; 

if( !(value is DataGridColumn) && dataField != null ){ 
contentValue = value[dataField];
this.text = value[dataField];
} 
}
}

]]>
</mx:Script>
<mx:CurrencyValidator id="cv" source="{this}" listener="{this}" property="text" 
alignSymbol="left" />
</mx:TextInput>

Reply via email to