Ad
Octobercms Backend Builder Forms - Automatic Validations?
I'm trying since a week to validate a backend Builder form...
Not using Builder validations rules with YAML, I put in my code $rules and $customMessages but they are note triggered when submitting my database.
My empty form is successfully created or updated !!! I thought Octobercms was doing the annoying validation job.
What I'm missing ? Thanks for helping, I'm driving crazy !
My Yaml has no validation rules :
fields:
client_name:
label: 'Name'
span: auto
type: text
and my model is :
use Model;
use Validator;
/**
* Model
*/
class Commande extends Model
{
use \October\Rain\Database\Traits\Validation;
use \October\Rain\Database\Traits\SoftDelete;
use \October\Rain\Database\Traits\Nullable;
protected $nullable = ['comment']; // Pour utilisation de Nullable trait
/*
* Disable timestamps by default.
* Remove this line if timestamps are defined in the database table.
*/
public $timestamps = false;
/**
* @var string The database table used by the model.
*/
public $table = 'lb_book_commandes';
/**
* @var array Validation rules
*/
public $rules = [
'client_name' => 'required'
];
// Messages d'erreur de validation
public $customMessages = [
'client_name.required' => 'Name not typed',
];
// Affichage de plusieurs messages de validation en une fois.
public $throwOnValidation = false;
}
Ad
Answer
Finally, I solved my problem with this post : OctoberCMS plugin show all the validations at once
some code was disturbing validation...
Ad
source: stackoverflow.com
Related Questions
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page
Ad