PDA

View Full Version : Submit a form, and recieve non ajax data



deadManN
18 Jan 2013, 9:07 AM
Hello there, i have a login form, i want when i push submit button, it check data on server, and send new page data, if the post information is valid... but all i got is nothing, i check request through fire bug, and see the coming data goes to the ajax process, and does not parse with browser it self :|

what can i do?

here's my submit:


Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = 'lib/extjs-3.2.1/resources/images/default/s.gif';
Ext.QuickTips.init();

var login_form = new Ext.FormPanel({
url: 'actions/login-action.php',
////////////////////////////////actionMode: '_Blank',
waitMsgTarget: true,
waitMsg: 'Please Wait...',
title: false,
id: 'loginForm',
frame: true,
width: '100%',
height: '100%',
labelWidth: 100,
items:[
{
xtype: 'textfield',
name: 'username',
fieldLabel: 'Username',
width: 250,
listeners: {
specialkey: function(f,e){
if(e.getKey()==e.ENTER){
this.getForm().submit();
}
}
}
}, {
xtype: 'textfield',
name: 'password',
fieldLabel: 'Password',
width: 250,
specialkey: function(f,e){
if(e.getKey()==e.ENTER){
this.getForm().submit();
}
}
}, {
xtype: 'checkbox',
fieldLabel: 'Stay Logged In',
name: 'setCookie',
specialkey: function(f,e){
if(e.getKey()==e.ENTER){
this.getForm().submit();
}
}
}
],
buttons: [{
text: 'Login',
handler: function(){
login_form.getForm().submit({
success: function (f,e){

},
failure: function (f,e){
Ext.Msg.alert('Login Failed', e.result.errormsg);
}
});
}
}]
});

var login_win=new Ext.Window({
title: 'Login',
id: 'loginWin',
width: 400,
//height: 200,
closable: false,
draggable: false,
resizable: false,
items:[
login_form
]
});

login_win.show();
});

deadManN
19 Jan 2013, 6:47 AM
any help?

willigogs
19 Jan 2013, 12:07 PM
What are you receiving in the response?

console.log(f, e) in your success handler.

deadManN
19 Jan 2013, 2:21 PM
What i recieve is whole next page in get request, which goes to ajax method, but what i need is to load new page data, in new page, like redirecting from one page to one other....
i want to submit my form normally not throug ajax, how to do it?

willigogs
19 Jan 2013, 2:33 PM
I believe the basicForm has a 'standardSubmit' config which you might want to look into:
http://docs.sencha.com/ext-js/3-4/?mobile=/api/Ext.form.BasicForm#cfg-standardSubmit

Alternatively there are a couple of solutions that immediately popped up from a google search:
http://stackoverflow.com/questions/6150301/extjs-open-a-new-window-when-formpanel-submit-function-is-used
http://www.sencha.com/forum/showthread.php?14204-Ext2.0-formPanel-using-browser-submit-not-function

deadManN
19 Jan 2013, 9:58 PM
thanks you man a lot,
sry for lat answer, i have exam today, and went to sleep last night, i check out after my exam :)

deadManN
26 Jan 2013, 5:59 AM
sry for late asnwer, some important exam, then being out of connection, and a rest day...

i test all above, standard submit send request, but page refresh to the page is already open, i mean then again the login page come up :|

and for other, they dont seem to work, or i cant get them to work...

if you want i can submit (upload) whole login part to you