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

Forms can't display nested validation errors

Open thecyrilcril opened this issue 11 months ago • 0 comments

  • Laravel Version: 10.16.1
  • PHP Version: 8.1.13
  • Splade JS Version (npm): 1.4.15
  • Splade PHP Version (composer): 1.4.15.1
  • Dev environment (OS, Sail/Valet/etc): Windows 10 Pro.

Description:

When working with dynamically created form, validation errors don't display.

Steps To Reproduce Issue:

        <x-splade-form
            default="{
                receivers : [
                    {
                        full_name: '',
                    }
                ],
        
            }"
        
        >
              <template v-for="(receiver, index) in form.receivers" key="index">
                  ...
                  // this works
                  <x-splade-input v-model="receiver.full_name" label="Full Name" validation-key="receivers.0.full_name" class="mb-2" />
                  // this fails
                  <x-splade-input v-model="receiver.full_name" label="Full Name" validation-key="`receivers.${index}.full_name`" class="mb-2" />
                  ...
              </template>
         </splade-form>

Seems the validation-key attribute does not parse its value like v-text <span v-text="`receivers.${index}.full_name`"></span>does

thecyrilcril avatar Jul 31 '23 03:07 thecyrilcril