laravel-form-builder icon indicating copy to clipboard operation
laravel-form-builder copied to clipboard

Form is valid even if repeated fields are not the same

Open vince83110 opened this issue 6 years ago • 1 comments

I use Laravel 5.6 and your package, but I can't show an error when repeated fields are not the same.

I have 2 repeated fields in my form (email and password), I put different passwords but

$form->isValid()

returns true. Do I need to write my own validation ?

My password form is :

            ])->add('password', 'repeated', [
                'type' => 'password',
                'second_name' => 'password_confirmation',
                'first_options' => [
                    'template' => 'layout.forms.text_right',
                    'rules' => 'required',
                    'label' => __('customer.password'),
                ],
                'second_options' => [
                    'template' => 'layout.forms.text_right',
                    'rules' => 'required',
                    'label' => __('customer.password_confirmation'),
                ],
            ])

Thanks

vince83110 avatar Aug 03 '18 12:08 vince83110

Yeah, you need to write your own validation, there's no default support for that. This field type was added before the validation feature, so we should maybe update it to support that.

kristijanhusak avatar Aug 08 '18 09:08 kristijanhusak