0
votes

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;

}
1
are you working in backend with default settings of builder, any customization ? - Hardik Satasiya
No, I just designed a form with Builder. I understand that "required" in YAML or $rules just set a red dot, without providing verifications. It's not clear how : 1) I should trigger or check the verifications 2) I could force values in the fields (init or modifications after validation) October or Builder documentation lacks simple samples, not just a few lines of code... - Incremental

1 Answers

0
votes

Finally, I solved my problem with this post : OctoberCMS plugin show all the validations at once

some code was disturbing validation...