Skip to content

data-coreui-toggle="loading-button" prevents submitting action #543

New issue

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

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

Already on GitHub? # to your account

Closed
vladrusu opened this issue Oct 15, 2024 · 2 comments
Closed

data-coreui-toggle="loading-button" prevents submitting action #543

vladrusu opened this issue Oct 15, 2024 · 2 comments

Comments

@vladrusu
Copy link
Contributor

vladrusu commented Oct 15, 2024

Consider the following code:

<form>
...
<button type="submit" class="btn btn-primary" data-coreui-toggle="loading-button">Save</button>
</form>

Pressing Save button never submits the form. I don't think that adding data-coreui-toggle="loading-button" should prevent default action.

Of course, the bug is trivial to fix (loading-button.js):

  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
    // event.preventDefault(); --> remove this
    const button = event.target.closest(SELECTOR_DATA_TOGGLE);
    const data = LoadingButton.getOrCreateInstance(button);
    data.start();
  });
@mrholek
Copy link
Member

mrholek commented Oct 15, 2024

@vladrusu I appreciate your help. I was on holiday, and today, I'm back to work, I will check it ASAP.

@vladrusu
Copy link
Contributor Author

Thanks! Will close this. Added pull request #546.

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

No branches or pull requests

2 participants