You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2013/09/17 14:46:33 UTC

Re: Dynamic validation in AS

On Sep 16, 2013 7:36 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:

> Hi,
>
> I need to validate dynamic form data in Flex 4.5 ADG, meaning that I don't
> know column names,
> order, but if the attribute is Required, than I have to make sure user
> filled it in.
> From all examples I have seen, validations is done in MXML, but in my case
> since data is dynamic, it should be done in AS.
>
> Any samples?
>
> Data comes dynamically to ADG,
> but user can Add or Edit row in dynamically built Form.
>
> Please advise.
>
> TIA,
> Oleg
>

Re: Dynamic validation in AS

Posted by Oleg Konovalov <ol...@gmail.com>.
Oops, my mistake. It works just fine. Issue resolved.
Thank you, guys!!!
On Sep 18, 2013 10:23 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:

> I still get the same exception from the same line if I do that.
> Any other ideas?
> On Sep 17, 2013 10:50 PM, "Justin Mclean" <ju...@classsoftware.com>
> wrote:
>
>> Hi,
>>
>> > validator.source = "{field}";     <<< Error: source attribute "{field}"
>> can
>> > not be of Type String [from mx.validators::Validator/set]
>>
>> validator.source = field;?
>>
>> Justin
>>
>

Re: Dynamic validation in AS

Posted by Oleg Konovalov <ol...@gmail.com>.
I still get the same exception from the same line if I do that.
Any other ideas?
On Sep 17, 2013 10:50 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

> Hi,
>
> > validator.source = "{field}";     <<< Error: source attribute "{field}"
> can
> > not be of Type String [from mx.validators::Validator/set]
>
> validator.source = field;?
>
> Justin
>

Re: Dynamic validation in AS

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> validator.source = "{field}";     <<< Error: source attribute "{field}" can
> not be of Type String [from mx.validators::Validator/set]

validator.source = field;?

Justin

Re: Dynamic validation in AS

Posted by Paul Hastings <pa...@gmail.com>.
On 9/18/2013 9:22 AM, Oleg Konovalov wrote:
> validator.source = "{field}";     <<< Error: source attribute "{field}" can

shouldn't that just be

validator.source=field;

Re: Dynamic validation in AS

Posted by Oleg Konovalov <ol...@gmail.com>.
OK, I tried the following:

private function validateRequiredField(field:TextInput):void {
var validator:StringValidator = new StringValidator();
validator.source = "{field}";     <<< Error: source attribute "{field}" can
not be of Type String [from mx.validators::Validator/set]
validator.property = "text";
validator.requiredFieldError = "This field is required";
validators.push(validator);
}

Any idea why I am getting that error above?
I am passing Spark's TextInput control there, not a String.
Calling it in "for" loop going through Dictionary of TextInput object,
where Key is column name.

How can I fix it?

TIA,
Oleg.


On Tue, Sep 17, 2013 at 8:58 AM, Franck Wolff <fr...@graniteds.org>wrote:

> Don't know if it could help, but you can check this:
>
> http://www.graniteds.org/public/docs/3.0.0/docs/reference/flex/en-US/html/graniteds.validation.html
>
> F.
>
>
> 2013/9/17 Oleg Konovalov <ol...@gmail.com>
>
> > On Sep 16, 2013 7:36 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I need to validate dynamic form data in Flex 4.5 ADG, meaning that I
> > don't
> > > know column names,
> > > order, but if the attribute is Required, than I have to make sure user
> > > filled it in.
> > > From all examples I have seen, validations is done in MXML, but in my
> > case
> > > since data is dynamic, it should be done in AS.
> > >
> > > Any samples?
> > >
> > > Data comes dynamically to ADG,
> > > but user can Add or Edit row in dynamically built Form.
> > >
> > > Please advise.
> > >
> > > TIA,
> > > Oleg
> > >
> >
>



-- 
Thank you,
Oleg.

Re: Dynamic validation in AS

Posted by Franck Wolff <fr...@graniteds.org>.
Don't know if it could help, but you can check this:
http://www.graniteds.org/public/docs/3.0.0/docs/reference/flex/en-US/html/graniteds.validation.html

F.


2013/9/17 Oleg Konovalov <ol...@gmail.com>

> On Sep 16, 2013 7:36 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
>
> > Hi,
> >
> > I need to validate dynamic form data in Flex 4.5 ADG, meaning that I
> don't
> > know column names,
> > order, but if the attribute is Required, than I have to make sure user
> > filled it in.
> > From all examples I have seen, validations is done in MXML, but in my
> case
> > since data is dynamic, it should be done in AS.
> >
> > Any samples?
> >
> > Data comes dynamically to ADG,
> > but user can Add or Edit row in dynamically built Form.
> >
> > Please advise.
> >
> > TIA,
> > Oleg
> >
>