Results 1 to 9 of 9

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

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    9
    Vote Rating
    2
      0  

    Default 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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,385
    Vote Rating
    1540
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    9
    Vote Rating
    2
      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
    9
    Vote Rating
    2
      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
    Location
    GMT+1 - DST+1
    Posts
    75
    Vote Rating
    0
      0  

    Default 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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,385
    Vote Rating
    1540
      0  

    Default

    Form posts use extAction whereas other direct requests only use action.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  7. #7
    Sencha User
    Join Date
    Dec 2010
    Location
    GMT+1 - DST+1
    Posts
    75
    Vote Rating
    0
      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
    Location
    GMT+1 - DST+1
    Posts
    75
    Vote Rating
    0
      0  

    Default

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

  9. #9
    Sencha - Services Team Stju's Avatar
    Join Date
    Dec 2008
    Location
    Redwood city, California
    Posts
    293
    Vote Rating
    3
      0  

    Default

    Please refer to updated examples: https://github.com/jurisv/extdirect.examples

    This post explains undefined body: https://www.sencha.com/forum/showthr...22#post1101822

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •