I understand that the Validator.validateAll() method returns an array
of ValidationResultEvent objects. 

My question is, how do I access the name of the field that failed
validation? According to the docs, the "field" property of the
ValidationResultEvent object supplies this. But when I reference this
property, I consistently get "null", even though I specified the name
attribute of each form field.

What am I missing? (code below)
        
// Step 1: Handle "Save" button click
private function saveProfile():void {
// Validate all fields before submitting data
var arr:Array = Validator.validateAll(arrValidators);
// If the array returned by validateAll is not
// empty, then something failed validation
if(arr.length){
// Invoke a function to display the error messages 
// (see below for function definition)
displayValidationErrors(arr);
}else{
// submit form data
}
}

// Show results of call to validateAll
private function displayValidationErrors(arr:Array):void {
var str:String = "Please correct the following:\n\n";
for (var i:int = 0; i < arr.length; i++){
// This always prints "null message:"
// Why? How do I get it to print the
// name of the field?
str += arr[i].field + " message: "; 
// This prints the correct message, but does 
// not indicate which field the message
// is referring to
str += arr[i].message + "\n\n"; 
}
Alert.show(str,"Form Validation Message");
}






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/
 


Reply via email to