PDA

View Full Version : Ext.FormPanel.Add - Object required in IE



avladykin
16 Oct 2012, 1:36 PM
I want to create block for adding unlimited number of files to the form. I wanted to do it with Ext.FormPanel.

I do:
var file_new=new Object(new Ext.form.File({
"fieldLabel": 'Файл',
"name": 'file_'+frm.files_num,
"xtype": 'filefield',
"afterSubTpl": '<a title="Удалить этот файл" class="linkclass'+frm.files_num+'" id="'+frm.files_num+'" >X</a>'

}));
Ext.getCmp('simpleForm').add(file_new);




And it works ok in all browsers but IE write error "Object required". You can see it on my test page: http://bstocks.moscower.com/test.htm

How I can resolve this issue? Please help!

Thank you.

vietits
16 Oct 2012, 3:30 PM
Try to modify your code as below:


//var file_new = new Object(new Ext.form.File({
var file_new = new Ext.form.File({ // or Ext.create('Ext.form.File', {
"fieldLabel": 'Файл',
"name": 'file_'+frm.files_num,
"xtype": 'filefield',
"afterSubTpl": '<a title="Удалить этот файл" class="linkclass'+frm.files_num+'" id="'+frm.files_num+'" >X</a>'
});
Ext.getCmp('simpleForm').add(file_new);

SergZen
16 Oct 2012, 10:19 PM
Tried these options, including:

Ext.getCmp('simpleForm').add({
"fieldLabel": 'File',
"name": 'file_'+frm.files_num,
"xtype": 'filefield',
"afterSubTpl": '<a title="Delete file" class="linkclass'+frm.files_num+'" id="'+frm.files_num+'" >X</a>'
});

All options work in other browsers except IE.

Error in IE:

Message: Object required
Line: 21
Symbol: 137225
Code: 0
URI: ext-all.js

used version Ext 4.1.0

Problem this function:

ieTable:function(v,q,w,u){
p.innerHTML=[q,w,u].join("");
var r=-1,t=p,s;
while(++r<v){
t=t.firstChild
}
s=t.nextSibling; // here error
if(s){
t=document.createDocumentFragment();
while(s){
t.appendChild(s);
s=s.nextSibling
}
}
return t
}

vietits
16 Oct 2012, 11:40 PM
The following code works fine for me on IE 9, Ext 4.1.0 and Ext 4.1.1:

Ext.onReady(function(){
var form = Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 400,
height: 200
});
form.add({
"fieldLabel": 'File',
"name": 'file_1',
"xtype": 'filefield',
"afterSubTpl": '<a title="Delete file" class="linkclass1" id="1" >X</a>'
});
});

SergZen
17 Oct 2012, 4:06 AM
The following code works fine for me on IE 9, Ext 4.1.0 and Ext 4.1.1:

Ext.onReady(function(){
var form = Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 400,
height: 200
});
form.add({
"fieldLabel": 'File',
"name": 'file_1',
"xtype": 'filefield',
"afterSubTpl": '<a title="Delete file" class="linkclass1" id="1" >X</a>'
});
});

Thank you, for your answer.

I fix error remove "layout: 'form'".

Add to your form this: layout: 'form'
var form = Ext.create('Ext.form.Panel', {
layout: 'form',
renderTo: Ext.getBody(),
width: 400,
height: 200
});

And test in IE.