Skip to content

Using button instead of input[type=submit] prevents sub-sequent submission #3587

@philomelus

Description

@philomelus

When using <button hx-post="/foo" hx-target="#foo">Submit</button> instead of <input type="submit" value="Submit" hx-post="/foo" hx-taget="#foo">, after initial form submission, subsequent submissions are ignored.

I have a form that appends a table to bottom of page after the form is submitted. On first click of button, it works as expected. When I attempt to submit the form again, nothing happens. Repeatable infinitely.

After looking in htmx.js, I saw some code that looked specifically for input[type=submit], so I thought maybe it would work if I used an input instead of a button. I was correct. If I replace the button with a submit input, it works as expected.

The strange part is that another <button hx-post=...> on the page/form still worked, only the one that was submitted fails to work after the first submission. I did verify that the affected <button ...> still existed on the page and hadn't changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions