简体   繁体   中英

Uncaught TypeError: Cannot call method 'observe' of null / Uncaught ReferenceError: Draggable is not defined

I've been all over the related questions but couldn't find an answer to my problem.

http://s1308.hizliresim.com/1d/5/r50lw.png

When I click "Kredi Yükle" a popup should appear but nothing happens and i get these console errors.

What should i do?

In related js file :

CreditLoadingAmrEditor = Class.create({
SELECTION_WINDOW    : "wndCreditLoadingHelper",
BUTTON_OK           : "btnLoadCreditOk",
BUTTON_CANCEL       : "btnLoadCreditCancel",
CREDIT_AMOUNT       : "fld_credit_amount",

initialize: function(owner) {
    this.owner              = owner;
    this.browser            = owner.browser;
    this.buttonOk           = $(this.BUTTON_OK);
    this.buttonCancel       = $(this.BUTTON_CANCEL);
    this.selectionWindow    = this.initializeHelper(this.SELECTION_WINDOW);
    var containers = $$("div[id='loadingCreditContainer']");
    if (containers && containers.size() > 0) {
        this.container      = containers[0];
        this.editorManager  = new EditorManager("loadingCreditContainer");
        this.creditAmount   = $(this.CREDIT_AMOUNT).instance;
    }
    this.browser.addToolClickListener(this);
    this.buttonOk.observe(iconstants.KEY_CLICK, this.okClick.bindAsEventListener(this));
    this.buttonCancel.observe(iconstants.KEY_CLICK, this.closeClick.bindAsEventListener(this));
},

initializeHelper: function(windowName) {
    var result = $(windowName);
    if (result){
        result.remove();
        document.body.appendChild(result);
    }
    return result;
},

toolClick: function(browser, toolType) {
    if (toolType == browser.TOOL_LOAD_CREDIT) {
        this.show();
    }
    return false;
},

show: function(callback) {
    this.callback = callback;
    FSystem.registerWindow(this.selectionWindow, true, true);
},

hide: function() {
    FSystem.unregisterWindow(this.selectionWindow);
},

okClick: function() {
    if (this.creditAmount.getValue() >= 0) {
        this.hide();
        this.requestForLoadingCredit();
    } else {
        window.alert(localize("value_must_greater_than_0"));
    }
},

closeClick: function() {
    this.hide();
},

requestForLoadingCredit: function() {
    FSystem.startWait();
    new Ajax.Request(
            iconstants.URL_CREDIT_LOADING_AMR,
            {
                method      : iconstants.METHOD_POST,
                parameters  : {mid:this.browser.getSelectedId(),ca:this.creditAmount.getValue()},
                onComplete  : this.responseForDeviceReading.bind(this),
                onException : null
            });
},

responseForDeviceReading: function(transport) {
    FSystem.stopWait();
    var JSON = transport.responseText.evalJSON();
    if (JSON.status == iconstants.AJAX_STATUS_OK){
        //if (confirm(JSON.message)) {
        window.open(JSON.url, '_newtab', 'width=1280,height=800');
        //}
    } else {
        alert(JSON.message);
    }
}

});

Such type of error occur when your object is not initialized. You are trying to access a method of such object which is not initialized. Please check your object initialization.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM