Hybrid View
-
4 Feb 2008 3:21 AM #1
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
if i write method: 'POST', or GET nothing change...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'; }, }] })
please help me...
-
4 Feb 2008 3:49 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Try:
(this assumes that save-form.php produces the correct response, see docs)Code:buttons: [{ text:'Login', handler: function() { formPanel.getForm().submit({ success: function() { window.location.href = 'http://host/index.php'; } }); } }]
Another option would be to do a classic submit (see docs).
-
4 Feb 2008 4:53 AM #3
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 Feb 2008 4:55 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
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).
-
4 Feb 2008 5:21 AM #5
very strange... i have modified the code in this way
now the Login form pannel doesn't appear.. if i delete id: 'my-form', the form apper but don't workCode: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'; } }); } }]
any other solution??
-
4 Feb 2008 5:37 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
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); } }); } }],


Reply With Quote