Trigger Form Action using v2 Confirm Modal #1921
-
I'm trying to trigger a form action once the user clicks "confirm". It successfully triggers the form but doesn't pass the correct id and only triggers the first object in the each Imports.... const modal: ModalSettings = { const handleSubmit = () => { {each things as { id }} handleSubmit} type="submit">delete{/each |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I'm happy to help, but: A couple of things:
Also, if you want quicker chat-like support, we're available on Discord: https://discord.com/channels/1003691521280856084/1048010639219642419 |
Beta Was this translation helpful? Give feedback.
-
Sure! I wrote that using the GitHub app on my phone last night out of pure frustration. Here is my question properly formatted.
Oh and thank you for the quick response @Sarenor. Any help would be greatly appreciated. Also, if there is a better way to create this logic other than to trigger the form via an 'getElementById()` please don't hesitate to show me. Thanks again!
|
Beta Was this translation helpful? Give feedback.
-
But i think we should be able to pass variable to modals specially to confirm modal. |
Beta Was this translation helpful? Give feedback.
Well, you're triggering the form with the constant id
"form"
. Try this:And doing
document.getElementByID('form'+id)
.If it's not necessary that it's a form handler you could just use fetch and a delete request as well.