PDA

View Full Version : Set a validator to a field



timenam
17 Jun 2010, 1:49 AM
Hi,
i have a user interface designed with designer and i want add to a field of that UI a validator.
The ext designer allow me to define te property validationEvent but not the property validator.

How can i do? My validator is a function.
Thank you

j-joey
17 Jun 2010, 10:59 AM
you can use vtype. also you can register a vtype too, with your validator function. check this out: http://www.sencha.com/deploy/dev/examples/form/adv-vtypes.html

timenam
18 Jun 2010, 12:15 AM
Ok, i try this solution.
Thank you!

jarrednicholls
18 Jun 2010, 8:41 AM
Registering the vtype is a good solution. You could alternatively define the validator function in the initComponent call of your implementation (.js, not .ui.js) class for the Field, and use the field that way inside of the form. We'll be adding a feature called Promote to Class which will take a sub-component (like a field inside of a large form) and allow you to promote it to a "root" or "top-level" component, and thus make it exportable by your project. It will automatically be attached to the component it was originally a part of. Thus, adding special options in initComponent for a very "deep" child component will be much easier and natural for the Designer.

j-joey
18 Jun 2010, 10:46 AM
that's great jarred, i'm waiting eagerly that feature becomes alive.

timenam
21 Jun 2010, 12:56 AM
Thank you jarred for the reply. The feature that you've explain it's very great but when will be added to the designer? A new version is out soon?

jarrednicholls
21 Jun 2010, 3:26 AM
Yes, I would expect it out this week actually. Stay tuned.

timenam
21 Jun 2010, 6:32 AM
Ok, perfect...:D

timenam
28 Jun 2010, 5:10 AM
News? There are problems for the exit of the designer update?

jarrednicholls
28 Jun 2010, 6:36 AM
We're still working out issues for this update. It will be released soon and when it is you will get a notification when you open the application.

timenam
28 Jun 2010, 11:05 PM
Ok!