Search code examples
extjssencha-architect

Creating custom vTypes in Sencha Architect 3.0


How can I create custom vtypes for form fields validation in Sencha Architect 3.0. I have only found a way to include the already built in types but I want to create a custom one and include it.


Solution

    1. Create a new js based resource (or use existing one).
    2. Define vtype

      Ext.apply(Ext.form.field.VTypes, {
          myFancyValidator: function(val, field) {
              //... returns true if valid, false if not
          }
      }
      
    3. On the Project Inspector, browse to the field/editor that you want to validate

    4. Apply vtype:'myFancyValidator'