views:

51

answers:

1

i wrote a code that really worked perfect on local host but on my production server , i was showing error that Response.Result parameter on the success event attached to the submit button was not define but everything was ok on my local server, i re-posted the main extjs package on the server , thinking some files are corrupt , the problem still persist , please i don't know what else to do , my code is listed below.

The main line given problem is "resp.result.data.level;"

Ext.onReady(function () { Ext.QuickTips.init();

var login = new Ext.FormPanel({
    id: 'login_form',
    renderTo: 'login2',
    url: '../server/login.ashx',
    title: 'Enter your Pin Number and Jamb Number',
    width: 280,
    height: 250,
    labelAlign: 'top',
    bodyStyle: 'width:300px;height:300px;margin:0 auto;',
    frame: true,
    items: [

  { xtype: 'textfield', fieldLabel: 'Registration Numberss', name: 'reg', width: '70%', allowBlank: false, minLegth: 5, maxLength: 15 },
  { xtype: 'textfield', fieldLabel: 'Pin Number', name: 'pin', id: 'pin', width: '70%',
      allowBlank: false, inputType: 'password', minLegth: 5, maxLength: 15, minLengthText: 'Password must be at least 6 characters long.'
  }
  ],
    buttons: [{
        text: 'Login',
        handler: function () {
            pin = Ext.get('pin').getValue();

            login.el.mask('Please wait', 'x-mask-loading');
            login.getForm().submit({
                url: '../server/login.ashx',
                success: function (loginForm, resp) {



                    login.getForm().reset();
                    var level = resp.result.data.level;
                    if (level == "0") {
                        controller.getLayout().setActiveItem(1);
                    }
                    else if (level == "1") {
                        controller.getLayout().setActiveItem(2);
                        hostelData.load();
                    }
                    else {
                        document.location = "../hostelAllocation/Report.aspx?val=" + pin;

                    }



                },
                failure: function (loginForm, resp) {

                    login.el.unmask();


                    var status = resp.result.data.status;
                    var reg = resp.result.data.reg;
                    if (status == "0") {
                        Ext.MessageBox.alert('Failure', 'Invalid Pin!');
                    }
                    else {
                        Ext.MessageBox.alert('Failure', 'The pin has been used by another user,<br/> with User Name: ' + reg);
                    }

                }

            });

        }
    },
    { text: 'Cancel',
        handler: function () {
            document.location = "../index.htm"
        }

    }]

});
A: 

Check you server/login.ashx file. Chances are it is not the code if it worked in the same browser you were using to check your local instance. Im pretty sure its a login.ashx error and not a Javascript error.

Darren
Mr. Darren, I really appreciate your professional advice, the problem originated from my production server. The server was configured to support Dot Net framework 2.0, but i was using some .Net 4.0 features on my local server. So i have resolved it and it's working perfectly, thanks and God bless!
Adebayo Ade