PDA

View Full Version : Simple form - how to do so as Popup ??



tatoosh
7 Oct 2009, 10:54 AM
My code is working fine. The data is stored fine through JSON to my SQL DB.

But i want to open this form as a shor popup and not a fullscreen form.

can u give me some tips?

thx a lot.


Code:


Ext.onReady(function(){

Ext.QuickTips.init();

var simpleForm = new Ext.FormPanel ({
labelWidth: 75, // label settings here cascade unless overridden
url:'kontakt_createJ.php', // when this form submitted, data goes here
frame:true,
title: 'Kontakt hinzufuegen',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',

items: [{
/*
here same as <input type="text" name="name" /> in HTML
*/
fieldLabel: 'Name',
name: 'Kontakt_Name',
allowBlank:false
},{
fieldLabel: 'Firma',
name: 'Kontakt_Firma'
},{
fieldLabel: 'Land',
name: 'Kontakt_Land'
}],

buttons: [{
text: 'Save',
handler: function () {
// when this button clicked, sumbit this form
simpleForm.getForm().submit({
waitMsg: 'Saving...', // Wait Message
success: function () { // When saving data success
Ext.MessageBox.alert ('Message','Data has been saved');
// clear the form
simpleForm.getForm().reset();
},
failure: function () { // when saving data failed
Ext.MessageBox.alert ('Message','Saving data failed');
}
});
}
},{
text: 'Cancel',
handler: function () {
// when this button clicked, reset this form
simpleForm.getForm().reset();
}
}]

});

// finally render the form
simpleForm.render ('simple-form'); // render form to simple-form element (see simple-form.html)

});

zhegwood
7 Oct 2009, 2:15 PM
Create a window & put that form panel as the item... At least I think this is what you're after, right?

mitchellsimoens
7 Oct 2009, 6:31 PM
that's how I'd do it unless you want the regular browser alert type but the window class should work. I'd also take a look at the spotlight example to put focus on that window.

tatoosh
8 Oct 2009, 9:10 AM
ok i'll check the example, thx. i also will do so with the window.
you mean the window panel right?