Hybrid View

  1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    146
    Vote Rating
    0
    italoc is on a distinguished road

      0  

    Default submit external form and fort GET or POST metod

    submit external form and fort GET or POST metod


    i would like a login module in EXTJS but when i press login button i would like to pass the variable to external php pages.. i can force to redirect the pages when i press the login button but the variable don't are passed to destination page.

    this is my code

    Code:
    new Ext.FormPanel({
                        labelWidth: 50, 
                        url:'save-form.php',
                        frame:true,
                        collapsible: true,
                        title: 'Login',
                        bodyStyle:'padding:5px 5px 0',
                        width: 225,
                        defaults: {width: 140},
                        defaultType: 'textfield',
                
                        items: [{
                                fieldLabel: 'Username',
                                name: 'username',
                                allowBlank:false
                            },{
                                fieldLabel: 'Password',
                                name: 'password',
                                inputType:'password',
                                allowBlank:false
                            }
                        ],
                
                        buttons: [{
                            text:'Login',
                            type: 'submit',
                    handler: function() {
                            			window.location.href = 'http://host/index.php';
    	},				
                                 }]
                      })
    if i write method: 'POST', or GET nothing change...

    please help me...

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Try:

    Code:
    buttons: [{
      text:'Login',
      handler: function() {
        formPanel.getForm().submit({
          success: function() {
            window.location.href = 'http://host/index.php';
          }
        });
      }
    }]
    (this assumes that save-form.php produces the correct response, see docs)

    Another option would be to do a classic submit (see docs).

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    146
    Vote Rating
    0
    italoc is on a distinguished road

      0  

    Default


    i try this:

    buttons: [{
    text:'Login',
    handler: function() {
    formPanel.getForm().submit({
    success: function() {
    window.location.href = 'http://host/index.php';
    }
    });
    }
    }]

    but i receive always an error:

    formPanel is not defined
    [Break on this error] });

    can you post an example of save-form.php configuration? i try to read a docs, but i don't find a solution...

    thanks..

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    formPanel should be your FormPanel. If you don't want to store it in a variable you could give it and id and use Ext.getCmp(id).

  5. #5
    Ext User
    Join Date
    Feb 2008
    Posts
    146
    Vote Rating
    0
    italoc is on a distinguished road

      0  

    Default


    very strange... i have modified the code in this way

    Code:
    new Ext.FormPanel({
                        labelWidth: 50, 
                        url:'save-form.php',
                        frame:true,
                        collapsible: true,
                        title: 'Login',
                        bodyStyle:'padding:5px 5px 0',
                        width: 225,
                        defaults: {width: 140},
                        defaultType: 'textfield',
                        method: 'GET',
                        id: 'my-form',
                        items: [{
                                fieldLabel: 'Username',
                                name: 'username',
                                allowBlank:false
                            },{
                                fieldLabel: 'Password',
                                name: 'password',
                                inputType:'password',
                                allowBlank:false
                            }
                        ],
                
                                buttons: [{
                                text:'Login',
                                handler: function() {
                                formPanel = Ext.getCmp('my-form');
                                  formPanel.getForm().submit({
                                    success: function() {
                                      window.location.href = 'http://host/index.php';
                                    }
                                  });
                                }
                              }]
    now the Login form pannel doesn't appear.. if i delete id: 'my-form', the form apper but don't work

    any other solution??

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    1. The form should appear, even with the id (unless you already used this id elsewhere).
    2. Your server probably doesn't handle the submit correctly, try:

    Code:
    buttons: [{
    	text:'Login',
    	handler: function() {
    		Ext.getCmp('my-form').getForm().submit({
    			success: function() {
    				window.location.href = 'http://host/index.php';
    			},
    			failure: function(form, action) {
    				alert(action.failureType);
    			}
    		});
    	}
    }],

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar