This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ndcisiv
ndcisiv

I'm playing around with hooking into an event to do some verification before an Ajax Handler fires and I want to know if there is a way I can prevent the Ajax Handler from firing if a certain condition is met? So for example:

Event::listen('cms.component.beforeRunAjaxHandler', function($this, $handler) {
    if ($handler != 'onWhatever')
        return;

    // Do some checks and balances
    // If my checks fail, stop the 'onWhatever' from firing

});

Any ideas? I've tried returning false, clearing out the $handler variable... Thanks

Scott
Scott

I don't know your exact situation, but wouldn't it be simpler put the validation at the top of onWhatever()?

ndcisiv
ndcisiv

In my situation I don't own onWhatever(), it resides in someone else's plugin. But for what I wanted, exceptions handles it nicely.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.