silverstripe-module silverstripe-valitron
Better SilverStripe DataObject Validation With Valitron
jinjie/silverstripe-valitron
Better SilverStripe DataObject Validation With Valitron
- Thursday, July 12, 2018
- by jinjie
- Repository
- 1 Watchers
- 0 Stars
- 16 Installations
- PHP
- 3 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 0 % Grown
Better Validation for SilverStripe
A very simple validation that make use of Valitron. Provides a helper that add error messages to form fields., (*1)
use SilverStripe\ORM\DataObject;
use SwiftDevLabs\Valitron\Helper;
class MyDataObject extends DataObject {
// Validates DataObject
public function validate()
{
$result = parent::validate();
$v = new \Valitron\Validator([
'Field1' => $this->Field1,
'Field2' => $this->Field2,
]);
// Find more rules at https://github.com/vlucas/valitron
$v->rule('required', [
'Field1',
'Feild2',
]);
return Helper::validate($v, $result);
}
}
dev-ss3
dev-ss3
Better SilverStripe DataObject Validation With Valitron
Sources
Download
MIT
The Requires
by
Kong Jin Jie
0.9
0.9.0.0
Better SilverStripe DataObject Validation With Valitron
Sources
Download
MIT
The Requires
by
Kong Jin Jie
dev-master
9999999-dev
Better SilverStripe DataObject Validation With Valitron
Sources
Download
MIT
The Requires
by
Kong Jin Jie
1.0.0
1.0.0.0
Better SilverStripe DataObject Validation With Valitron
Sources
Download
MIT
The Requires
by
Kong Jin Jie