PDA

View Full Version : Ext 2.0 - Form in a Window



undefined
31 Jul 2007, 3:06 AM
Help !!

This is in respect to Ext 2. I created a form comprising of 3 text fields inside a window. The problem here is on submission of the form the success action takes place but no parameters of the form are passed. The code isn't throwing any error and is working. Any idea guys ??

thejoker101
31 Jul 2007, 3:09 AM
Help !!

This is in respect to Ext 2. I created a form comprising of 3 text fields inside a window. The problem here is on submission of the form the success action takes place but no parameters of the form are passed. The code isn't throwing any error and is working. Any idea guys ??

Did you neglect to put "name" in your field configs?

undefined
31 Jul 2007, 3:22 AM
All the form fields have the 'name' property defined respectively.

undefined
31 Jul 2007, 3:24 AM
All the form fields have the 'name' property defined respectively.
Following is the complete code.


Ext.onReady(function()
{
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';

var target = document.body;

var formContent = new Ext.form.Form(
{
url : 'nogo.php',

}
)

var username = new Ext.form.TextField(
{
fieldLabel : 'Username',
name : 'username',
width : 175,
allowBlank : false,
emptyText : 'username comes here',
blankText : 'Username cannot be left blank'

}
);

var password = new Ext.form.TextField(
{
fieldLabel : 'Password',
name : 'password',
allowBlank : false,
emptyText : 'password comes here',
width : 175,
blankText : 'Password cannot be left blank'
}
);

var companyId = new Ext.form.TextField(
{
fieldLabel : 'Company Id',
name : 'companyId',
allowBlank : false,
emptyText : 'company id comes here',
width : 175,
blankText : 'Company Id cannot be left blank'
}
);


formContent.add(companyId, username, password);
formContent.addButton('Save').on('click', function()
{
if(formContent.isValid())
{
formContent.submit(
{


waitMsg : 'Checking..',
success : function(form, action)
{
win.hide();

},
failure : function()
{
Ext.MessageBox.alert('Failed', 'Failed');
}
}
)
}
}
);







var win = new Ext.Window(
{
animateTarget : target,
title : 'Login Window',
width : 400,
height : 300,
draggable : false,
closable : false,
frame : true,
items : [formContent],
buttons :
[
{
text : 'Hide Window',
handler : function()
{
win.hide();
}
}
]

}
);

win.show();
}
);

thejoker101
31 Jul 2007, 3:45 AM
Do you have Firebug installed? If so, does anything show up in the POST of the request?

undefined
31 Jul 2007, 3:56 AM
Firebug present - errors absent.
Have firebug installed it aint showing any errors.

thejoker101
31 Jul 2007, 4:15 AM
Firebug present - errors absent.
Have firebug installed it aint showing any errors.

What I mean is, do you see a request going out to 'nogo.php' and if so, is there anything under the POST tab if you expand it? This can be found under the console tab or the net tab.

undefined
31 Jul 2007, 5:02 AM
Thats what made me write for help Joker. The firebug shows a request going to nogo.php but the post tab under it is completely blank.
Just a thought
going to add a panel to the window which will contain the form.

larest
15 Aug 2008, 9:27 AM
Hi!
I get like trouble . Look at http://extjs.com/forum/showthread.php?t=44329