willowtreeapps/marionette.formview — pull request #1 by tlegard (2014-08-27 15:16:32+00:00)
Title: Exposed

## Exposes Marionette FormView's Validator Hash

Allows the Marionette FormView's access to it's formValidator object. This makes it easy to inherit rules from parent form views. Just add

`_.extend(FormView.prototype.formValidator, inheritableRules);`

Where inheritableRules is some hash of rules you wish to be shared.

For example, in ProjectX we're including in the Marionette Patch the following lines

```javascript
_.extend(Marionette.FormView.prototype.formValidator, {
encodeable: function(val) {
try {
window.btoa(val);
} catch (e) {
return false;
}
return true;
}
});
```

This will allow all `Marionette.FormViews` access to the `encodeable` rule. Yes, I know it's a stupid rule... but it's not my fault!