Class: ConfirmSubmit

ConfirmSubmit()

<brut-confirm-submit>

Confirms form submissions with the user before allowing the form to be submitted. This is applied to buttons, not forms, to allow for finer control over the behavior.

  • This only works for button or input type=submit
  • The elements must have a form, either by being inside a form or having a form attribute.
  • If the form is not valid, it will not show the confirmation dialog.

By default, this will use external:Window#confirm. if "OK" is pressed, the button click goes through and the form would be submitted. If "Cancel" is pressed, the event is prevented.

If there is a brut-confirmation-dialog on the page, this component can use that, possibly with help from the dialog attribute as followed:

  • If dialog is set:
    • If that id is on a <brut-confirmation-dialog> that is used.
    • If not, window.confirm is used.
  • If dialog is not set:
    • If there is exactly one <brut-confirmation-dialog> on the page, this is used.
    • If there is more than one, or no <brut-confirmation-dialog>s, window.confirm is used.

If the wrong dialog or notification method is happening, set show-warnings on the element, and it will print out why it's doing what it's doing.

Constructor

new ConfirmSubmit()

Properties:
Name Type Description
message string

the message to show that asks for confirmation. It should be written such that "OK" is grammatically correct for confirmation and "Cancel" is for aborting.

dialog string

optional ID of the brut-confirmation-dialog to use instead of window.confirm. If there is no such dialog or the id references the wrong element type, window.confirm will be used. Setting show-warnings will generate a warning for this.

Source:
See: