lordisp's avatar

Prevent Livewire Pagination from submittin a form

I have a stacked form (i shorted the code to the minimum) which has checkboxed from a model. The list has a pagination (I'm using the WithPagination traid)

The problem is now, when I click on a page link, the form gets submited. I've tried to prevent this by adding the prevent to <button wire:click.prevent="nextPage"> This helped but now the submit button at the end of the form does not work anymore.

<form wire:submit.prevent="save" >
<input wire:model="name" type="text">
@foreach($operations as $operation)
<div class="flex items-start">
    <div >
      <x-input type="checkbox" id="{{$operation['operation']}}" name="{{$operation['operation']}}"/>
    </div>
    <div>
    <label for="operation">{{$operation['operation']}}</label>
   <p >{{$operation['description']}}</p>
  </div>
</div>
@endforeach
{{ $operations->links() }}
<x-btn.primary>
           Save
</x-btn.primary>
</form>

I'm not sure if the shorted code is sufficient to underdant the context of the issue

0 likes
1 reply
lordisp's avatar
lordisp
OP
Best Answer
Level 8

it's resolved; I found a second form tag in the code which caused this behavior

Please or to participate in this conversation.