dont forget. in flex2 this functionality is already waiting to be used. check out the DataGrid/ veryfyng edited data example
http://flexapps.macromedia.com/flex2beta2/flex_explorer/explorer.html --- In [email protected], "gault17" <[EMAIL PROTECTED]> wrote: > > Andrew, > > I had created a custom DataGrid that overrode the setFocusedCell > function. This allowed me to create my custom TextInput as the cell > editor and add a listener on the cellFocusOut event. This listener > populated the event object value and colName attributes. The purpose > of using this approach was to have the flexibility to create a > different cellEditor for each column. However, since this approach > seems overly complex and does not seem to port well to Flex 2.0, I > used the cell renderer approach that Doug and bod suggested. Thanks! > > Gary > --- In [email protected], "Andrew Trice" <andrew.trice@> > wrote: > > > > Gary, > > > > I put your code into a sample application. For me, it returned a > > validation error for any value that is put into the TextInput > object. I > > modified your code to get validation working, although it is still > > ignoring the colName variable. I am not sure where that value is > being > > set or what it represents. How is this being used? Are you using > it as > > a custom implementation for a normal mx:TextInput object, or are you > > using it as a custom cell renderer for a mx:DataGrid object? > > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:TextInput xmlns:mx="http://www.macromedia.com/2003/mxml" > > > > > <mx:Script> > > > > <![CDATA[ > > > > > > > > function customValidate() { > > > > > > > > var validator = > > arguments[0][0].validator; > > > > > > > > if ( this.text != "test" ) validator.validationError( null, "The > value > > does not equal 'test'.", null ); > > > > } > > > > ]]> > > > > </mx:Script> > > > > > > > > <mx:Model id="theModel"> > > > > <text>{text}</text> > > > > </mx:Model> > > > > > > > > <mx:Validator field="theModel.text" > > validate="customValidate(arguments)" listener="this" /> > > > > > > > > </mx:TextInput> > > > > > > > > -Andy > > > > > > > > > > > > _____________________________________ > > > > Andrew Trice > > > > Cynergy Systems, Inc. > > > > http://www.cynergysystems.com > > > > > > > > Email: andrew.trice@ > > > > Office: 866-CYNERGY > > > > > > > > ________________________________ > > > > From: [email protected] > [mailto:[EMAIL PROTECTED] On > > Behalf Of Ault, Gary - BLS > > Sent: Wednesday, April 12, 2006 2:30 PM > > To: [email protected] > > Subject: [flexcoders] Custom dg validator > > > > > > > > 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 > > > > > > > > > > SPONSORED LINKS > > > > Web site design development > > <http://groups.yahoo.com/gads? > t=ms&k=Web+site+design+development&w1=Web+ > > > site+design+development&w2=Computer+software+development&w3=Software+ d > es > > > ign+and+development&w4=Macromedia+flex&w5=Software+development+best+p r > ac > > tice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ> > > > > Computer software development > > <http://groups.yahoo.com/gads? > t=ms&k=Computer+software+development&w1=We > > > b+site+design+development&w2=Computer+software+development&w3=Softwar e > +d > > > esign+and+development&w4=Macromedia+flex&w5=Software+development+best + > pr > > actice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw> > > > > Software design and development > > <http://groups.yahoo.com/gads? > t=ms&k=Software+design+and+development&w1= > > > Web+site+design+development&w2=Computer+software+development&w3=Softw a > re > > > +design+and+development&w4=Macromedia+flex&w5=Software+development+be s > t+ > > practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> > > > > Macromedia flex > > <http://groups.yahoo.com/gads? > t=ms&k=Macromedia+flex&w1=Web+site+design+ > > > development&w2=Computer+software+development&w3=Software+design+and+d e > ve > > > lopment&w4=Macromedia+flex&w5=Software+development+best+practice&c=5& s > =1 > > 66&.sig=OO6nPIrz7_EpZI36cYzBjw> > > > > Software development best practice > > <http://groups.yahoo.com/gads? > t=ms&k=Software+development+best+practice& > > > w1=Web+site+design+development&w2=Computer+software+development&w3=So f > tw > > > are+design+and+development&w4=Macromedia+flex&w5=Software+development + > be > > st+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> > > > > > > > > > > > > ________________________________ > > > > YAHOO! GROUPS LINKS > > > > > > > > * Visit your group "flexcoders > > <http://groups.yahoo.com/group/flexcoders> " on the web. > > > > * To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/> . > > > > > > > > ________________________________ > > > -- 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/

