Jaykesh Patel
Jaykesh Patel

Reputation: 2168

Laravel 5.2 Validation not working

I have following forms

{{ Form::text("theme[header_color]", '', []) }}
{{ Form::text("theme[bg_color]", '', []) }}
{{ Form::text("theme[text_color]", '', []) }}

I added following rules in request method.

theme[text_color]="required",
theme[bg_color]="required",
theme[text_color]="required"

I enter value in all field but still getting required validation error.

Please help have a look and help us.

THanks

Upvotes: 2

Views: 192

Answers (1)

Dharmesh Rakholia
Dharmesh Rakholia

Reputation: 1238

Try this code does this help

        $rules = array(
            'theme.text_color' => 'required',
            'theme.bg_color' => 'required',
            'theme.header_color' => 'required',
        );
        $messages = [
            'theme.text_color.required' => 'Please add Text Color.',
            'theme.bg_color.required' => 'Please add Text Color.',
            'theme.header_color.required' => 'Please add Header Color.',
          ];

Upvotes: 1

Related Questions