Created
March 2, 2011 22:05
-
-
Save andrerocker/851846 to your computer and use it in GitHub Desktop.
Então ja posso me considerar um AS3 ninja ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bvti.coelho.view.components.ui.validators | |
{ | |
import mx.collections.ArrayCollection; | |
import mx.validators.ValidationResult; | |
import mx.validators.Validator; | |
import spark.components.TextInput; | |
public class InicialFinalValidator extends Validator | |
{ | |
public var inicial:TextInput; | |
override protected function doValidation(value:Object):Array | |
{ | |
var valorInicial:String = inicial.text; | |
var valorFinal:String = value.toString(); | |
if(valorInicial.length>0 && valorFinal.length==0) | |
return [new ValidationResult(true, null, "preenchimento obrigatorio", "Preencha o valor final")]; | |
var numericoValorInicial:Number = new Number(valorInicial); | |
var numericoValorFinal:Number = new Number(valorFinal); | |
if(numericoValorFinal < numericoValorInicial) | |
return [new ValidationResult(true, null, "final invalido", "O valor Final deve ser maior que o Inicial")]; | |
return []; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment