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 <[email protected]>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 <[email protected]>
>
> > On Sep 16, 2013 7:36 PM, "Oleg Konovalov" <[email protected]> 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.