Hello,
I use CodeIgniter 3 and GroceryCrud Enterprise.
I couldn’t find any information about preformating data before it goes through Valitron.
This is to do some trimming as I would do it before on Community Edition when it used CodeIgniter validation.
Thanks in advance
1 Like
johnny
2
Hello @DavidBinaud I guess you are looking for https://www.grocerycrud.com/docs/callback-before-update and callbackBeforeInsert | Grocery CRUD functions. You can now also do the validation there and return a custom message, for example (copied from the documentation):
$crud->callbackBeforeInsert(function ($stateParameters) {
if ($stateParameters->data['status'] === 'Rejected') {
$errorMessage = new \GroceryCrud\Core\Error\ErrorMessage();
return $errorMessage->setMessage("You can't add a Rejected status\n");
}
return $stateParameters;
});
Hi, would this allow me to change the data before it goes through Valitron?
i don’t need to validate anything myself, just remove some extra spaces.