Back
verifies()
Instructs CFWheels to verify that some specific criterias are met before running an action.
Note that all undeclared arguments will be passed to redirectTo()
call if a handler
is not specified.
// Tell CFWheels to verify that the `handleForm` action is always a `POST` request when executed.
verifies(only="handleForm", post=true);
// Make sure that the edit action is a `GET` request, that `userId` exists in the `params` struct, and that it's an integer.
verifies(only="edit", get=true, params="userId", paramsTypes="integer");
// Just like above, only this time we want to invoke a custom function in our controller to handle the request when it is invalid.
verifies(only="edit", get=true, params="userId", paramsTypes="integer", handler="myCustomFunction");
// Just like above, only this time instead of specifying a handler, we want to `redirect` the visitor to the index action of the controller and show an error in The Flash when the request is invalid.
verifies(only="edit", get=true, params="userId", paramsTypes="integer", action="index", error="Invalid userId");
Copied!