1
goffy
cancel button
  • 11/11 11:21

  • goffy

  • Just can't stay away

  • Posts: 543

  • Since: 2010/12/27


hi

it seems that there is a problem with cancel button in bootstrap5
currently we are using
button class="btn btn-danger me-1" onClick="history.go(-1);return true;"  _CANCEL . /button

but this cause that it is treated like clicking on confirm button, as the submit event takes place

my solution is to replace by
input type="button" class="btn btn-danger me-1" name="cancel" id="cancel" onClick="history.go(-1);return true;" value=". _CANCEL . "


I created a PR https://github.com/XOOPS/XoopsCore25/pull/1481

or is there a better solution?

2
Mamba
Re: cancel button

A better solution seems to be to use
button type="button"
like this:
<button type="button" class="btn btn-danger me-1" name="cancel" id="cancel" onClick="history.go(-1);return true;">' . _CANCEL . 'button>
- Clarity: Each button's purpose is explicitly defined by its type attribute (submit, reset, button), making the form's behavior clear at a glance. - Uniformity: Using the same element type for all buttons enhances uniformity, making styling and scripting more predictable. - Ease of Updates: If you decide to add features like tooltips, loading indicators, or other interactive elements, "button" elements offer more flexibility. - "button" elements are also more flexible for styling
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

Login

Who's Online

299 user(s) are online (114 user(s) are browsing Support Forums)


Members: 0


Guests: 299


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Dec 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits