SPAS 3.0 Forums: General

You have been banned from this forum. If you have any questions, please contact the Administrator.

Sign in or create an account

You are logged in as:

Is it possible to use Validator in other components?

Page : 1

Reply New topic
Author Message
Community Member
Join Date: 2012-01-23
Posts: 24
Post date 02-12-2012, 11:14
#1
I was wondering if it is possible to attach Validator (Date, String, or any other) to:

a. Flash/Flex standard TextInput / DataGrid component? If so, can you describe how?

b. Other SPAS component (besides FORM)? If so, can you describe how?



Administrator
Join Date: 2008-12-01
Location: French Riviera
Posts: 47
Post date 02-13-2012, 13:07
#2
Well, the fact is that Validator object are juste used to return a Boolean value that indicates whether the expression to check is valid or not.

So, in theory, it is possible to use a Validator instance to validate an expression as shown below:

var ipVal:IPAdressValidator = new IPAdressValidator();
ipVal.validate(255.0.0.toto); // Will returns false.


But Validator objects wont change the appearence of an object. This is an internal SPAS process.

Creator of SPAS 3.0
Community Member
Join Date: 2012-01-23
Posts: 24
Post date 02-13-2012, 13:35
#3
Thanks.
Than is it possible to change component appearance on SPAS textinput for instance?

Administrator
Join Date: 2008-12-01
Location: French Riviera
Posts: 47
Post date 02-13-2012, 17:49
#4
No it isn't.
But you can do it manually by checking the value of the text property:
var s:String = myText.text;
var isvalid:Boolean = myValidator.validate(s);
myText.borderColor = isvalid ? "blue" : "red";

(Untested, just some thoughts)


Creator of SPAS 3.0

Page : 1