Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input type file issue (again, sorry!) #729

Open
Jaiieq opened this issue Nov 23, 2024 · 0 comments
Open

Input type file issue (again, sorry!) #729

Jaiieq opened this issue Nov 23, 2024 · 0 comments

Comments

@Jaiieq
Copy link

Jaiieq commented Nov 23, 2024

References: #711

I've done a full composer update so I have the latest flux and the 'x-ref' field that references the filename still is not clearing itself of the last selected filename (or filenames, e.g. '2 files')

Here is my simple blade component:

<form wire:submit='save'>
      <flux:input type="file" wire:model="attachments" multiple />
      <flux:error name="attachments" />
      <div class="flex items-center justify-center gap-x-4 mt-6">
          <flux:modal.close>
              <flux:button variant="ghost" wire:click='cancel' id='test'>Cancel</flux:button>
          </flux:modal.close>
          <flux:button type="submit" variant="primary">Submit</flux:button>
      </div>
</form>

For completeness, this is the wire:click cancel function. The same happens on a successful 'save' as well

public function cancel()
{
    $this->reset('attachments');
    $this->resetErrorBag();
    $this->resetValidation();
}

I've tried all of the following, which properly clears the input field value, but not the x-ref value that is displayed. I've also tried clearing the input via the console with vanilla javascript, but nothing seems to trigger the change to the x-ref div

$this->reset('attachments');
$this->attachments = [];
$this->attachments = null;

The only way I can get it to clear the x-ref is after clicking the "Choose Files" button is to then click cancel out of the open file dialog.

Am I missing something? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant