|
From: Mandy S. <ma...@gm...> - 2008-03-20 18:41:57
|
anyone?
On Thu, Mar 20, 2008 at 10:40 PM, Mandy Singh <ma...@gm...> wrote:
> Hi,
>
> I am trying to play with the Validation Class.
>
> However, I am stuck at one place.
>
> I have to_name and to_email input fields on stage and a mc_submit movie.
>
> Here is my action script.
>
> import org.asapframework.util.forms.validate.*;
> import org.asapframework.util.*;
>
> myValidator = new Validator();
> myValidator.addValidation(new NumericValidator(to_name));
> myValidator.addValidation(new EmailValidator(to_name));
> myValidator.addValidation(new EmailValidator(to_email));
> mc_submit.onRelease = function() {
> var formResult:ValidationResult = myValidator.validate();
> ObjectUtils.traceObject(formResult, 20);
> };
>
> Here is what I get when I hit submit button without filling anything.
>
> {
> success: false
> errors : [
> 2 : {
> rule : {
> mCondition: null
> mTarget: _level0.to_email
> ]
> target: _level0.to_email
> ]
> 1 : {
> rule : {
> mCondition: null
> mTarget: _level0.to_name
> ]
> target: _level0.to_name
> ]
> 0 : {
> rule : {
> mCondition: null
> mTarget: _level0.to_name
> ]
> target: _level0.to_name
> ]
> ]
> ]
>
> As per the doc, I should get ValidationError.rule : failing rule for this
> target (IValidationRule)
>
> However, I do not get that.
>
> I would need this to throw the error message?
>
> Also, is there a better way to do this, ie, the field with error gets
> highlighted on its own?
>
> Let me know.
>
> Thanks,
> Mandy.
>
> p.s. You svn example doesn't get checked out. I get an error that host
> does not exist.
>
|