CBWIRE
v4.x
v4.x
  • Introduction
  • How It Works
  • Getting Started
  • Configuration
  • Releases
    • What's New With 4.1
    • What's New With 4.0
    • What's New With 3.2
    • What's New With 3.1
    • What's New With 3.0
    • What's New With 2.2
    • What's New With 2.1
    • What's New With 2.0
  • Resources
  • Upgrading from CBWIRE 3.x
  • Upgrading from CBWIRE 2.x
  • CBWIRE CLI
  • The Essentials
    • Components
    • Templates
    • Data Properties
    • Computed Properties
    • Data Binding
    • Actions
    • Events
    • Nesting Components
    • Lifecycle Methods
    • JavaScript
    • Testing
  • Features
    • Single-file Components
    • Alpine.js
    • Lazy Loading
    • Form Validation
    • File Uploads
    • Query String
    • Redirecting
    • WireBox
  • Template Directives
    • wire:click
    • wire:confirm
    • wire:dirty
    • wire:ignore
    • wire:init
    • wire:key
    • wire:loading
    • wire:model
    • wire:navigate
    • wire:offline
    • wire:poll
    • wire:stream
    • wire:submit
    • wire:transition
  • Advanced
    • Troubleshooting
Powered by GitBook
On this page
  • Overview
  • Prompting for input

Was this helpful?

Export as PDF
  1. Template Directives

wire:confirm

Previouswire:clickNextwire:dirty

Last updated 7 months ago

Was this helpful?

Overview

You can use wire:confirm in your 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>
templates