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
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

