Home Forums General Issues Extend and Override Parent Event Handler


Extend and Override Parent Event Handler

  • Hello!,

    I want to extend acf.validation so I have code like below.

    (function ($) {
        acf.validation = acf.validation.extend({
            _super: acf.validation,
            fetch: function ($form) {
                console.log('child fetch');
            submit_form: function (e) {
                console.log('child submit form');
                return false;

    Now my question is how to extend event handler such that it does not execute parent event handler.

    Here fetch is method it works fine, parent is not executed only child fetch method is only executed when acf.validation.fetch() is called. But submit_form is event handler and both parent and child handlers are executed when submit form event is fired. I can do like $(document).off('submit'); before declaring, but it seems like bad solution.

    Thanks in advanced for your replies.


Viewing 1 post (of 1 total)

The topic ‘Extend and Override Parent Event Handler’ is closed to new replies.