wire:confirm

Overview

You can use wire:confirm in your templates to prompt users for confirmation before executing actions. This can be useful when dealing with potentially irreversible actions such as deletions or updates.

// ./wires/Subscription.cfc
component extends="cbwire.models.Component" {
    function cancelSubscription() {
        // Logic to cancel the subscription
    }
}
<!--- ./wires/subscription.cfm --->
<div>
    <button type="button" wire:click="cancelSubscription" wire:confirm="Are you sure you want to cancel your subscription?">
        Cancel Subscription
    </button>
</div>

Prompting for input

You can add a .prompt modifier if you want to require an extra layer of confirmation.

// ./wires/Subscription.cfc
component extends="cbwire.models.Component" {
    function cancelSubscription() {
        // Logic to cancel the subscription
    }
}
<!--- ./wires/subscription.cfm --->
<div>
    <button type="button"
        wire:click="cancelSubscription"
        wire:confirm.prompt="Please confirm cancellation by typing 'CANCEL' below|CANCEL">
        Cancel Subscription
    </button>
</div>

Last updated