Here's a code snippet that works in Flex 1.5. It may
need some refactoring for version 2. This code uses
the StringValidator. If Validator.isStructureValid
fails, myfield_ti will be highlighted in red and there
will be a little message saying it's a required field
(or whatever the particular validator has by default,
or a custom message you setup). Check the
documentation for other types of validators you can
use or extend one of them and do your own logic. You
can set custom messages in attributes of the validator
or through a custom validator.   

************ MXML ****************

<mx:Model id="myModel">
        <myFieldName>{myfield_ti.text}</myFieldName>
</mx:Model>

<mx:StringValidator field="myModel.myFieldName"/>

************ ACTIONSCRIPT ****************
// do this in the method that runs when you click your
submit button

Validator.enable(this,"myModel.myFieldName");
if (Validator.isStructureValid(this, 'myModel')) {
        //add code here to submit form 
}



--- Alex & Alex <[EMAIL PROTECTED]> wrote:

> Hi Mike,
> 
> I understand the login, but how do I reference the
> validation?
> 
> I mean what would actually go where you have
> "validation is success".
> 
> I'm not an actionscrip expert! I'm a cfforever guy
> ;-).
> 
> Alexander
> 
> 
> --- In flexcoders@yahoogroups.com, "Dreamer"
> <[EMAIL PROTECTED]> wrote:
> >
> > Alex & Alex,
> > 
> >     you can write a function,like that.
> >     
> >     if(validation is success)
> >             addMember();
> >     else
> >             alert("invalid input!!!");
> > 
> > ��������������
> >  Peace,
> >                              
> >
����������������Dreamer
> >
[EMAIL PROTECTED]
> >
��������������������2006-04-01
> > 
> > ======= 2006-04-01 18:32:22 ��=======
> > 
> > >
> > >Hello,
> > >
> > >In a signup form, when I click the submit button
> I would like for 
> all 
> > >the validation to happen and then actually hit
> the addMember() 
> > >function.
> > >
> > >But if a form fails the validation how can I
> prevent the 
> execution of 
> > >addMember().
> > >
> > >Thanks,
> > >Alexander
> > >
> > >
> > >
> > >
> > >
> > >--
> > >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
> > >
> > >
> > >
> > > 
> > >
> > >
> > >
> > 
> > = = = = = = = = = = = = = = = = = = = =
> >                     
> > 
> > ��
> >
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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