Supported Validation Rules

Bancha will automatically transform the following CakePHP validation rules into Ext JS/Sencha Touch validation rules.

  • General rules:
    • notempty

  • String rules:
    • minLength
    • maxLength
    • between
    • alphaNumeric
    • email
    • url

  • Number rules:
    • numeric with an additional config “precision”. To allow two decimal places you would define: ‘precision’=>2
    • range (please always define precision when using range so that Bancha knows how to round)

  • File rules:
    • extension (the rule marks that this is an file field, property extension can be an array of allowed types)

BanchaRemotableBehavior useOnlyDefinedFields config

(Default: true)
By default ExtJS only send changes to the server, therefore the CakePHP doesn’t get the whole record and Model::save should only save changed fields. Note that this is forced even for “normal” cake requests. If true the model also saves and validates records with missing fields. If you set this to false please use model->saveFields($data, $options) for saving ExtJS data with partial model fields.

It can be disabled by setting the config like this:

array('Bancha.BanchaRemotable'=>array('useOnlyDefinedFields'=>false));

Comments

Add a comment