Re: RE: [flexcoders] Validatior's binding problem?

2006-02-22 Thread KAZUYA KOMON
Hi,

oh peter, Thank you very much !!
It works very fine! Super!

Best Regards,
KAZUYA KOMON


- Original Message -
>From : Peter Watson <[EMAIL PROTECTED]>
To : flexcoders@yahoogroups.com
Sent : Wed, 22 Feb 2006 04:56:08 -0800
Subject : RE: [flexcoders] Validatior's binding problem?


> Hi Kazuya,
> 
>  
> 
> As Matt said - in Flex 1.5, validators don't support binding.
> 
>  
> 
> Below is a workaround for your issue.  
> 
>  
> 
> I got most of the code from here:
> 
> http://blog.daemon.com.au/archives/000317.html
> 
>  
> 
>  
> 
> Main.mxml
> 
> *
> 
> 
> 
> http://www.macromedia.com/2003/mxml";
> xmlns:local="*">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> {name1.text}
> 
> {name2.text}
> 
> 
> 
> 
> 
>  field="test.secondField" validate="testField(event.validator,
> event.value)"/>
> 
> 
> 
> 
> 
> 
> 
>  maxChars="5"/>
> 
> 
> 
> 
> 
>  id="name2"/>
> 
> 
> 
> 
> 
> 
> 
>  
> 
>  
> 
> RequiredFieldValidator.as
> 
> 
> 
> class RequiredFieldValidator extends mx.validators.Validator {
> 
> public var numLength:Number;
> 
> 
> 
> public function RequiredFieldValidator(){
> 
> 
> 
> }
> 
> public function doValidation(fieldString) : Void{
> 
>  
> RequiredFieldValidator.validateValue(this, fieldString, null,
> numLength);
> 
> }
> 
> public static function
> validateValue(validator:mx.validators.Validator, fieldString:String,
> subField, numLength) : Boolean{
> 
> var tempValue = new String(fieldString);
> 
> 
> 
> if(tempValue.length > numLength){
> 
>  
> validator.validationError("TooLong", "You entered " + tempValue.length +
> " characters. The limit is " + numLength, subField);
> 
>             return false;
> 
> }
> 
> return true;
> 
> }
> 
> }
> 
>  
> 
>  
> 
> regards,
> 
> peter
> 
>  
> 
>  
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of KOMON Kazuya
> Sent: Wednesday, February 22, 2006 1:40 AM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Validatior's binding problem?
> 
>  
> 
> Hi, Matt
> 
> Thank you for your reply.
> 
> I watched the source which generated, it became "undefined" in case of
> binding.
> That was a reason.
> 
> Thank you,
> KAZUYA KOMON
> 
> -Original Message-
> Sorry, Validators in 1.5 can't accept binding, they're special
> components.  We changed that in 2.0.  
> 
> Matt
> 
> -Original Message-
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of KAZUYA KOMON
> Sent: Monday, February 20, 2006 12:05 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Validatior's binding problem?
> 
> Hi, all
> 
> 
> I'm trying to bind attribute from MXML file to custom validator.
> (using 1.5)
> 
> 
> // Code(MXML) :
>  numLength="{name.maxChars}"/>
> ^
> 
> 
> 
> // Code(ActionScript - RequiredFieldValidator.as) :
> class RequiredFieldValidator extends mx.validators.Validator {
> var numLength:Number;
> ^
> ...
> }
> 
> 
> If I set number directory (ex. numLength="5") , I can.
> But if I use binding, I can't.
> Is there something a good idea?
> 
> Any help is greatly appreciate.
> 
> 
> Thanks,
> KAZUYA KOMON
> 
> 
> --
> 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

RE: [flexcoders] Validatior's binding problem?

2006-02-22 Thread Peter Watson










Hi Kazuya,

 

As Matt said – in Flex 1.5,
validators don’t support binding.

 

Below is a workaround for your issue. 


 

I got most of the code from here:

http://blog.daemon.com.au/archives/000317.html

 

 

Main.mxml

*





    

    

    

    

    

    {name1.text}

    {name2.text}

    

    

    

    

    

    

    

    

    

    

    

    



 

 

RequiredFieldValidator.as



class RequiredFieldValidator extends
mx.validators.Validator {

    public var
numLength:Number;

    

    public
function RequiredFieldValidator(){

    

    }

    public
function doValidation(fieldString) : Void{

    RequiredFieldValidator.validateValue(this,
fieldString, null, numLength);

        }

    public
static function validateValue(validator:mx.validators.Validator,
fieldString:String, subField, numLength) : Boolean{

    var
tempValue = new String(fieldString);

    

    if(tempValue.length
> numLength){

    validator.validationError("TooLong",
"You entered " + tempValue.length + " characters. The limit is
" + numLength, subField);

        return
false;

    }

    return
true;

    }

}

 

 

regards,

peter

 

 









From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of KOMON Kazuya
Sent: Wednesday, February 22, 2006
1:40 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders]
Validatior's binding problem?



 

Hi, Matt

Thank you for your reply.

I watched the source which generated, it became
"undefined" in case of binding.
That was a reason.

Thank you,
KAZUYA KOMON

-Original Message-
Sorry, Validators in 1.5 can't accept binding,
they're special
components.  We changed that in 2.0.  

Matt

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of KAZUYA KOMON
Sent: Monday, February 20, 2006 12:05 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Validatior's binding
problem?

Hi, all


I'm trying to bind attribute from MXML file to
custom validator.
(using 1.5)


// Code(MXML) :

   
numLength="{name.maxChars}"/>
    ^



// Code(ActionScript - RequiredFieldValidator.as)
:
class RequiredFieldValidator extends
mx.validators.Validator {
    var numLength:Number;
   
^
    ...
}


If I set number directory (ex.
numLength="5") , I can.
But if I use binding, I can't.
Is there something a good idea?

Any help is greatly appreciate.


Thanks,
KAZUYA KOMON


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








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











Re: [flexcoders] Validatior's binding problem?

2006-02-22 Thread KOMON Kazuya
Hi, Matt

Thank you for your reply.

I watched the source which generated, it became "undefined" in case of binding.
That was a reason.

Thank you,
KAZUYA KOMON

-Original Message-
Sorry, Validators in 1.5 can't accept binding, they're special
components.  We changed that in 2.0.  

Matt

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of KAZUYA KOMON
Sent: Monday, February 20, 2006 12:05 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Validatior's binding problem?

Hi, all


I'm trying to bind attribute from MXML file to custom validator.
(using 1.5)


// Code(MXML) :

^



// Code(ActionScript - RequiredFieldValidator.as) :
class RequiredFieldValidator extends mx.validators.Validator {
var numLength:Number;
^
...
}


If I set number directory (ex. numLength="5") , I can.
But if I use binding, I can't.
Is there something a good idea?

Any help is greatly appreciate.


Thanks,
KAZUYA KOMON


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


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




RE: [flexcoders] Validatior's binding problem?

2006-02-21 Thread Matt Chotin
Sorry, Validators in 1.5 can't accept binding, they're special
components.  We changed that in 2.0.  

Matt

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of KAZUYA KOMON
Sent: Monday, February 20, 2006 12:05 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Validatior's binding problem?

Hi, all


I'm trying to bind attribute from MXML file to custom validator.
(using 1.5)


// Code(MXML) :

^



// Code(ActionScript - RequiredFieldValidator.as) :
class RequiredFieldValidator extends mx.validators.Validator {
var numLength:Number;
^
...
}


If I set number directory (ex. numLength="5") , I can.
But if I use binding, I can't.
Is there something a good idea?

Any help is greatly appreciate.


Thanks,
KAZUYA KOMON


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



 




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