G
G
grigorie19902019-07-06 13:26:42
symfony
grigorie1990, 2019-07-06 13:26:42

How to display error in form builder (laravel, symphony)?

No error message is displayed in the form when the field is not filled, built with the form builder (form symphony) used in laravel

])->add("interfaceLangs", "entity", [
            "expanded" => true,
            "multiple" => true,
            "class" => "App\Models\ApplicationInterfaceLang",
            "property" => "label",
            "label_attr" => ["class" => "control-label required"],
            "rules" => "required_with:name",
            "selected" => function ($langs) {
                if (!$langs) {
                    return [];
                }

                return $langs->pluck("id")->toArray();
            },
            'choice_options' => [
                'wrapper' => ['class' => 'form-check-inline checkbox mb-2'],
            ],
            "error_messages" => [
                "language.required_with" => 'Обязательное поле',
            ],
            "label" => "Языки интерфейса",

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question