Saint Father
7 Dec 2011, 3:51 AM
i use form.Panel with htmleditor item and filefield item ..
when i try to save, the content of the htmleditor cut after first quotes;
when i remove a filefield item, the form (application/x-www-form-urlencoded) send full content from htmleditor without cutting;
please help me:
what could be the problem and how can I fix it?
form.Panel:
var newsForm = Ext.create('Ext.form.Panel', {
title: 'General info',
width: 800,
frame: true,
border: false,
bodyStyle: 'padding: 5px;',
items: [
{ xtype: 'hidden', name: 'id' },
{ xtype: 'filefield', fieldLabel: 'Preview', name: 'filename' },
{ xtype: 'htmleditor',
name: 'full_content',
height: 300,
width: 780,
fieldLabel: 'News content' }
],
buttons: [
{ text: 'Close',
handler: function() { editNewsWindow.close();}
},
{ text: 'Save',
formBind: true,
disabled: true,
handler: function() { saveNewsItem(); }
},
{ text: 'Save and close',
formBind: true,
disabled: true,
handler: function() { saveNewsItem(true); }
}
]
});
save button handler:
var saveNewsItem = function(close) {
if (newsForm.getForm().isValid()) {
newsForm.getForm().submit({
url: '/admin/news/save/',
success: function(thisform, action) {
if (action.result.success) {
if (close) { editNewsWindow.close(); }
newsStore.load();
var newsRecord = action.result.data; newsForm.getForm().setValues(newsRecord);
if (newsRecord.filename != 'undefined') {
newsImage.setSrc('/img/1/' + newsRecord.filename + '?' + Math.random());
}
newsId = newsRecord.id;
tabpanel.contentId = newsRecord.id;
tabpanel.items.each(function(tab) { tab.enable(); }); newsForm.getForm().setValues(newsRecord); newsForm.getForm().findField('slug').disable();
}
},
failure: function(form, action) { }
});
}
}
when i try to save, the content of the htmleditor cut after first quotes;
when i remove a filefield item, the form (application/x-www-form-urlencoded) send full content from htmleditor without cutting;
please help me:
what could be the problem and how can I fix it?
form.Panel:
var newsForm = Ext.create('Ext.form.Panel', {
title: 'General info',
width: 800,
frame: true,
border: false,
bodyStyle: 'padding: 5px;',
items: [
{ xtype: 'hidden', name: 'id' },
{ xtype: 'filefield', fieldLabel: 'Preview', name: 'filename' },
{ xtype: 'htmleditor',
name: 'full_content',
height: 300,
width: 780,
fieldLabel: 'News content' }
],
buttons: [
{ text: 'Close',
handler: function() { editNewsWindow.close();}
},
{ text: 'Save',
formBind: true,
disabled: true,
handler: function() { saveNewsItem(); }
},
{ text: 'Save and close',
formBind: true,
disabled: true,
handler: function() { saveNewsItem(true); }
}
]
});
save button handler:
var saveNewsItem = function(close) {
if (newsForm.getForm().isValid()) {
newsForm.getForm().submit({
url: '/admin/news/save/',
success: function(thisform, action) {
if (action.result.success) {
if (close) { editNewsWindow.close(); }
newsStore.load();
var newsRecord = action.result.data; newsForm.getForm().setValues(newsRecord);
if (newsRecord.filename != 'undefined') {
newsImage.setSrc('/img/1/' + newsRecord.filename + '?' + Math.random());
}
newsId = newsRecord.id;
tabpanel.contentId = newsRecord.id;
tabpanel.items.each(function(tab) { tab.enable(); }); newsForm.getForm().setValues(newsRecord); newsForm.getForm().findField('slug').disable();
}
},
failure: function(form, action) { }
});
}
}