Redirecting
Methods to redirect your users where you need.
You can redirect users in your actions using relocate().
<cfscript>
function redirectToURI() {
return relocate( uri="/some-url" );
}
function redirectToURL() {
return relocate( uri="https://www.google.com" );
}
function redirectToEvent(){
return relocate( event="examples.index" );
}
function redirectWithFlash() {
relocate( event="example.index", persistStruct={
confirm: "Redirect successful"
} );
}
</cfscript>
<cfoutput>
<div>
<button wire:click="redirectToURI">Redirect To URI</button>
<button wire:click="redirectToURL">Redirect To URL</button>
<button wire:click="redirectToEvent">Redirect To Event</button>
<button wire:click="redirectWithFlash">Redirect With Flash</button>
</div>
</cfoutput>Arguments
CBWIRE's relocate() method signature is nearly identical to ColdBox's internal relocate() method, except that status codes cannot be set. Otherwise, most of the arguments that ColdBox accepts can be used.
Last updated