1. #1
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    1
    VredevoogdA is on a distinguished road

      0  

    Default Direct won't work in Login, works elsewhere in app

    Direct won't work in Login, works elsewhere in app


    I am using Ext 5, and a node backend. I already have 4 direct calls going to the server and returning data correctly. I have added a new direct call for the login function. I have put it in the application.js file to check the login before the app is rendered. Upon clicking the login button I am getting the error: Ext.data.Connection.setOptions(): No URL specified. Any help will be appreciated.

    Application.js file:

    Code:
       Ext.define('ServcSol.Application', {
               extend: 'Ext.app.Application',
        
        name: 'ServcSol',
        
        requires:[
          'ServcSol.DirectAPI',
          'Ext.form.action.DirectSubmit'
        ],
        
        views: [
        'manyviewshere'    ],
    
        controllers: [
            'manycontrollershere'     ],
    
        stores: [
           'manystoreshere'     ],
        
        launch: function () {
    	  var win = Ext.create('Ext.window.Window', {
    		closable : false,
    		resizable : false,
    		draggable : false,
    		border : false,
    	        title: 'Service Solutions',
    	        titleAlign: 'left',
    	        height: 800,
    	        width: 1000,
    	        api: {
    	          submit: 'ExtRemote.DXLogin.authenticate'
    	         },
    	        paramOrder: ['username', 'pwd'],
    	        layout: {
    	          type: 'vbox',
    	          align: 'center',
    	          pack: 'center'
    	        },
    		items: [
    		  {
    		    xtype: 'form',
    		    title: 'Login',
    		    itemId: 'login',
    		    height: 300,
    		    width: 300,
    		    frame: true,
    		    layout: {
    			    type: 'vbox',
    			    align: 'center'
    			  },
    	            items:[
    		    {
    		        xtype: 'textfield',
    		        margin: '30 0 0 0',
    			itemId: 'username',
    		        fieldLabel: 'User Name',
    			allowBlank: false,
                            name: 'username',
                            emptyText: 'Username',
                            width: 225,
                            labelWidth: 100
    		    },
    		    {
    		       xtype: 'textfield',
    		       margin: '10 0 0 0',
    		       inputType: 'password',
    		       fieldLabel: 'Password',
    		       allowBlank: false,
    	               name: 'pwd',
    	               emptyText: 'Password',
    	               width: 225,
    	               labelWidth: 100
    		    },
    		    {
    		       xtype: 'button',
    		       text: 'Login',
    		       margin: '20 0 0 0',
    		       itemId: 'loginBtn',
    		       width : 80,
    		       formBind: true,
    		       handler: function(){
    		       var loginFrm = Ext.ComponentQuery.query('#login')[0];
    		       loginFrm.getForm().submit({
    			      success: function(form, action) 
    			      {
    			         Ext.create('ServcSol.view.Viewport');
    			         win.destroy();
    			      },
    				 failure: function(form, action) 
                                  {
    			         console.log('Login Failed');
    			      }
    			});	     
    		     }  
    		 }
                 ]} 
    	  ] 
          }) 
          win.show();
          } 
      
    });
    DirectAPI.js file:

    Code:
    Ext.define('ServcSol.DirectAPI', {
    
        requires: ['Ext.direct.*']
    }, function() {
        var Loader = Ext.Loader;
    
        //Loading API
        Loader.loadScriptsSync(['http://server/directapi']);
    
        Ext.direct.Manager.addProvider(ExtRemote.REMOTING_API);
    });

  2. #2
    Sencha - Senior Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,021
    Vote Rating
    980
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Code:
    Ext.direct.Manager.addProvider(ExtRemote.REMOTING_API);
    Should go in the application launch method. The http://server/directapi loading should get added to app.json with remote set to true or within a <script> tag within index.html. You shouldn't load something sync, it will lock up the browser for the time it takes to load the resource and there are better ways to do it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    1
    VredevoogdA is on a distinguished road

      0  

    Default


    Thanks for your help!

    I added this to the launch method in the application.js file.
    Code:
    launch: function () {
            Ext.direct.Manager.addProvider(ExtRemote.REMOTING_API);
            var win = Ext.create('Ext.window.Window', {
    I added the script file to app.json file (where server is my server address)

    Code:
    "js": [        
            {
                "path": "app.js",
                "bundle": true
            },
            {
                "path": "http://server/directapi",
                "remote": true
            }
        ],
    I have commented out the previos api file call
    Code:
    requires:[     
          'Ext.direct.*',
          //'ServcSol.DirectAPI',
          'Ext.form.action.DirectSubmit'
        ],
    The other 4 api calls are successfully running. When I click the login button I am still getting the error[E] Ext.data.Connection.setOptions(): No URL specified followed by Uncaught Error: No URL specified

    I have also tried changing this submit call to reference one of the working api calls, just to make sure it was not my new login api call, I get the same error.

    Any help is appreciated!

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    4
    Vote Rating
    1
    VredevoogdA is on a distinguished road

      0  

    Default


    I took the login code out of the application file and put it into a login.js view. I created a login controller to handle the login button click and the submit to the server. I was having an api issue but it appears to have been unrelated. The login is now working perfectly.

  5. #5
    Sencha User
    Join Date
    Dec 2010
    Posts
    60
    Vote Rating
    -1
    squalo is an unknown quantity at this point

      0  

    Default extAction undefined

    extAction undefined


    I got the same approach but when I call the remote method for authentification
    Code:
    ExtRemote.DXLogin.authenticate(form.getValues());
    called through the Login Controllers Button, I got always the same Node.Js Backend Error:
    Code:
    TypeError: Cannot read property 'extAction' of undefined
    unfortunately even twice (Don't know why twice).
    The problem is, that in
    Code:
     processRoute(req,...)
    // from router.js (taken from jurisv/nodejs.extdirect samples) 
    var data = req.body,...
    that "req.body" does not exit.

    Really appreciating any hints, because I'm going to loose my head meanwhile in debugging.

  6. #6
    Sencha - Senior Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,021
    Vote Rating
    980
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Form posts use extAction whereas other direct requests only use action.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User
    Join Date
    Dec 2010
    Posts
    60
    Vote Rating
    -1
    squalo is an unknown quantity at this point

      0  

    Default


    sorry, but I don't understand. I'm using a form but extAction is undefined!?

  8. #8
    Sencha User
    Join Date
    Dec 2010
    Posts
    60
    Vote Rating
    -1
    squalo is an unknown quantity at this point

      0  

    Default


    Unfortuantely still waiting for help :-( This topic is really annoying.

Thread Participants: 2

Tags for this Thread