Thanks for the suggestion. In case anyone is interested, this is the code that worked:
<?xml version="1.0" encoding="utf-8"?> <mx:TextInput xmlns:mx="http://www.macromedia.com/2003/mxml" > <mx:Model id="theModel"> <text>{text}</text> </mx:Model> <mx:Validator field="theModel.text" validate="customValidate( event.validator, event.value )" listener="this" /> <mx:Script> <![CDATA[ var colName; var colValue; var listOwner : Object; var getCellIndex : Function; var getDataLabel : Function; function setValue(str:String, item:Object, selection:String ):Void { colName = listOwner.getColumnAt (getCellIndex).columnIndex).columnName; } function customValidate(validator, value ) { if (colName =="rptPricesOper" && value != "T") { validator.validationError( null, "Value must be T", null ); } } // end customValidate ]]> </mx:Script> --- In [email protected], "bhaq1972" <[EMAIL PROTECTED]> wrote: > > are you using your textinput as the cell renderer ie > > <mx:DataGridColumn columnName="rptPricesOper" > cellRenderer="yourTextInput"/> > > if so, you can do add a setValue function to your textinput and as > mentioned, use listOwner and getcellIndex to get the colName eg > > add following code to your script block > <mx:Script> > var colName; > var listOwner : Object; > var getCellIndex : Function; > var getDataLabel : Function; > > function setValue(str:String, item:Object, selection:String ):Void > { > colName = listOwner.getColumnAt(getCellIndex().columnIndex); > } > > Check out flex2. its made for this kind of thing > > regards > bod > > > > --- In [email protected], "Ault, Gary - BLS" > <Ault.gary@> wrote: > > > > In Flex 1.5, I am trying to create a PowerBuilder-esque column > > validator. I use a custom TextInput field with a Validator so that > when > > a user tabs out of a column, the validation check is triggered. It > > appears to work for a simple test, but I cannot get the validation > error > > to trigger for other conditions. Can anyone see a flaw or have > another > > approach to share? Thanks. Here is my custom TextInput with > validator: > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:TextInput xmlns:mx="http://www.macromedia.com/2003/mxml" > > > <mx:Model id="theModel"> > > <text>{text}</text> > > </mx:Model> > > > > <mx:Validator field="theModel.text" validate="customValidate( > event )" > > listener="this" /> > > > > <mx:Script> > > <![CDATA[ > > > > function customValidate(event ) { > > var validator = event.validator; > > var value = event.value; > > var colName = event.colName; > > //this works > > //if ( value != "test" ) > > //validator.validationError( null, "Value > must > > be an arithmetic operator", null ); > > //this does not work > > if (colName =="rptPricesOper" && value != "test") > > validator.validationError( > null, "Value > > must be an arithmetic operator", null ); > > > > } // end customValidate > > ]]> > > </mx:Script> > > > > </mx:TextInput> > > > > > > Gary Ault > > Bureau of Labor Statistics > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

