laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

hasMany form validation not working on single submit click

Open Sivan4562 opened this issue 9 months ago • 4 comments

  • Laravel Version: ^10.10
  • PHP Version: 8.1
  • Laravel-admin: ^1.8

Description:

Hi Team, I am using the hasMany form and I use the ->rules('required') for the form required field when I click the submit button the first time the validation error does not throw the error message when I click the second time it shows the error. Do you know how I can fix this? I attached my code as below.

This is form data

$form->hasMany('customer_experience','Experience Info',function (Form\NestedForm $form) {
   $form->text('title', 'Title')->rules('required');
   $form->text('company', 'Company')->rules('required');
   $form->text('location', 'Location')->rules('required');
   $form->date('start_date', 'Start Date')->rules('required');
   $form->date('end_date', 'End Date')->rules('required');
});

And model

public function customer_experience(){
       return $this->hasMany(CustomerExperience::class, 'customer_id');
}

Can anyone help me to fix this bug?

Sivan4562 avatar Sep 13 '23 10:09 Sivan4562