-
21 Jun 2012 10:27 AM #1
question about form submission
question about form submission
I am confused a bit on trying to make my form submit.
Here is the code I am using for the form panel and the submit button.
I am trying to direct the form to a perl script to do the database work but after I fill out the form, nothing happens.
I took the code for the submit button directly from the docs, I'm not needing to do anything fancy, just submit the form.
Anyone have a suggestion?
Code:var simpleForm = new Ext.FormPanel ({ labelWidth: 175, url:'storage_new_project_action.pl', method: 'POST', frame:true, title: 'Ada a New Project', bodyStyle:'padding:5px 5px 0', width: 850, defaultType: 'textfield', items: [ { fieldLabel: 'Project Name', name: 'ProjectName', allowBlank:false, anchor:'100%' }, { fieldLabel: 'Project Manager', name: 'ProjectManager', allowBlank:false, anchor:'100%' }, { fieldLabel: 'IT Senior Manager', name: 'ITSeniorManager', allowBlank:false, anchor:'100%' }, { fieldLabel: 'Primary Release Manager', name: 'PrimaryReleaseManager', allowBlank:false, anchor:'100%' }, { fieldLabel: 'Project Description', name: 'Description', xtype: 'textarea', anchor:'100%' }, { xtype: 'fieldset', title: 'Projected Growth', autoHeight: true, autoWidth: true, collapsible: false, collapsed: false, items: [projections_grid] } ], buttons: [{ text: 'Submit', formBind: true, //only enabled once the form is valid handler: function() { var form = this.up('simpleForm').getForm(); if (form.isValid()) { form.submit({ success: function(form, action) { Ext.Msg.alert('Success', action.result.msg); }, failure: function(form, action) { Ext.Msg.alert('Failed', action.result.msg); } }); } } },{ text: 'Cancel', handler: function () { // when this button clicked, reset this form simpleForm.getForm().reset(); } }] });
-
21 Jun 2012 9:44 PM #2
Hi!
just put a debugger or set a break point and debug your code.
Check what are you getting in the var form, i.e.
and also check in the console whether your form is valid or not, because if your form is not valid, success or failure will not be there (according to your code)Code:var form = this.up('simpleForm').getForm();sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
22 Jun 2012 7:31 AM #3
-
23 Jun 2012 6:53 AM #4
You are not evaluating simpleForm correctly in your button handler:
Regards,Code:handler: function(btn) { // grab the xtype of the parent for button, // or var form = btn.up('form'), // or var form = this.up('form'), // or assign itemId to form and use var form = btn.up('#formItemId') var form = btn.up('form'); // you have assign this to a var; // so just use simpleForm: simpleForm.getForm(); var form = this.up('simpleForm').getForm(); // will not work }
Scott.
-
25 Jun 2012 6:37 AM #5
Thanks for the reply Scott, I was able to get it working.


Reply With Quote