PDA

View Full Version : Uncaught TypeError when show form



neosky
6 Feb 2014, 3:05 AM
i am have form with grid and button (add record) on this form, when i am click button show other form with textbox's, on this form i have button add (then information on textfields send to grid). But i have problem: if i am load my project and first time click button (add record) show form with textbox's i am enter information and click button (add) all good and in grid add new record, but when i am click on button (add record) second time i am have this error: Uncaught TypeError: Cannot read property 'dom' of undefined
this code in controller:


FormAddShow: function(button) {
var win = button.up('window');
var view = Ext.widget('record-create',
{
bookid: parseInt(Ext.Archive.getBookId()),
date: Ext.Archive.getDate(),
});
view.on('close', function() {
win.down('booklistgrid').getStore().reload();
}) }



doAddRecord: function(button) {
var win = button.up('window')
form = win.down('form')
values = form.getValues();
var request = {
'id': values['id'],
'name': values['name'],
'price': values['price'], }
Ext.Ajax.request({
url: '/bookprice/add',
method: 'POST',
jsonData: request,
success: function(responseObject) {
var obj = Ext.decode(responseObject.responseText)
win.close(); } }); },

scottmartin
11 Feb 2014, 1:07 PM
Sounds like you are destroying and then trying to access it again.

Use devtools and set a breakpoint on your call and step through your code to see what is no longer available.