livewiere modal always submit after input tags
helo friends,
i need help
i make refrence modal using laravel livewire, im using tagify input in the form
my problem is after input tag using tab or comma button submit always click
please help
thanks
Replies (3)
Hi,
You're welcome! I'm glad to hear that you were able to resolve the issue. If you have any more questions or need further assistance in the future, don't hesitate to reach out. Have a great day!
Thanks
Hi,
It sounds like you're using a Livewire modal with a Tagify input in a form, and you're encountering an issue where pressing the "Tab" or "Comma" button triggers the form submission. To address this, you can consider the following steps:
-
Prevent Default BehaviorWhen the "Tab" or "Comma" button is pressed, it might trigger the default behaviour of moving to the following input field or triggering the form submission. You can prevent this default behaviour using JavaScript. -
JavaScript Event HandlingYou can add event listeners to the Tagify input element to capture the "Tab" and "Comma" key presses. Inside the event handlers, you can prevent the default behavior and handle the tag creation manually. -
Livewire InteractionEnsure that Livewire interactions and form submissions do not conflict with the event handling. You might need to use Livewire'swire:ignoredirective on the Tagify input to exclude it from Livewire reactivity.
Here's a simplified example of how you might approach this:
Please adjust the code as per your specific use case and implementation. The key is to prevent the default behaviour of the "Tab" and "Comma" keys and implement custom logic to handle tag creation without triggering the form submission.
Remember that the actual implementation might require more details from your end, but this should give you a general idea of how to handle the situation.