Hi Luis,

It's been a few days so perhaps you already have a solution to this. I'm also just learning myself so I haven't tested this sample code.

If it's something that is just defined in the model, and won't change, then it doesn't need to be bound. You can make a constant in your model if you need it application-wide, and then use that value when you define the TextInput.

In the model:

public const TEXT_MAX_CHARS : Number = 10; // This is if you need a constant and don't want it to change of course
public var textMaxChars : Number = 10; // if you want it to be changeable

in MXML

<mx:TextInput maxChars="{ model.TEXT_MAX_CHARS }" />

or if you want it on the validator

<mx:StringValidator maxLength="{ model.TEXT_MAX_CHARS }" />

etc.

Perhaps one of the more experienced folks will supply an answer. If not, hope it helps!

Michael

Luis Eduardo wrote:


Is there a way to bind the maxChars of a TextInput on an entry of my
Model?

the length of the data should be defined in the model, i think. (not
on a validator. perhaps the validator should take this information from
the model)

rigth?

Reply via email to