in the following example when we click the button, all the form data (both the
KEY-VALUE) will be passed to the php file to be saved in the database. Grabbing the
KEY-VALUE, I think this is done by
var form = this.up('form').getForm(); statement.
Code:
buttons: [{
text: 'Submit',
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function(form, action) {
Ext.Viewport.setActiveItem(1);
Ext.Msg.alert('Success', action.result.successmessage);
Ext.create('Ext.container.Viewport', {
//layout: 'fit',
items: [
{
xtype: 'newal'
}
]
});
},
What is the equivalent code of var form = this.up('form').getForm(); . I am using MVC, and my Model looks like;
View:
Code:
this.buttons =[
{
text:'Save',
id:'save',
name:'save',
},...
Store:
Code:
Ext.define('Game.store.myviewstore',{
extend:'Ext.data.Store',
model:'App.model.myviewstore',
proxy:{
actionMethods :{
create :'POST'
},
type:'ajax',
url :'/savetodb.php'
}
});
I need to grab the Key-Value pair of the textfields in the View class and Pass it as parameters to the /savetodb.php file. So that the PHP will use it and save it to the database.
But, i am unable to get the values of the textfields here. What have i done wrong and how could i make it correct ?
note: if i hard code the PHP file with values, then it gets saved in the DB, but not the values that i passed from the VIEW of my application