P
pbd22
Hi.
I have a script bellow that, when it gets called,
throws "fileList[myFile] has no properties. I have
checked to make sure that all the elements on
the page that the loop calls are there and have
id/name tags and everything checks out. Not
sure what is causing this:
<script type="text/javascript">
var fileList = new Array();
function addFile(myFile) {
try{
var frm = document.uploadForm;
for (var f = 0; f < frm.elements.length; f++)
{
if (frm.elements[f].className == "input") {
fileList[myFile][frm.elements[f].name] = '';
}
}
}catch(e){alert(e.message + " and the count is " + f);}
} ...
IF the above code doesn't show you what my problem is, then
I have added some more information (SKIP it if you don't need it).
Otherwise, continue reading...
The addFile function is called inside addRow() which is here:
//adds a DIV row with file link in innerHTML
addRow:function(){
if( this.max == 0 || this.elements.length <= this.max ){
current_element = this.elements.getLast();
// Create new row in files list
var name = current_element.element.value;
addFile(name);
[SNIP] ...
And, addRow is initialized below (called from the init function):
initializeElement:function( element ){
// What happens when a file is selected
element.addEvent(
'change',
function(){
this.addRow()
}.bind( this )
);
I have a script bellow that, when it gets called,
throws "fileList[myFile] has no properties. I have
checked to make sure that all the elements on
the page that the loop calls are there and have
id/name tags and everything checks out. Not
sure what is causing this:
<script type="text/javascript">
var fileList = new Array();
function addFile(myFile) {
try{
var frm = document.uploadForm;
for (var f = 0; f < frm.elements.length; f++)
{
if (frm.elements[f].className == "input") {
fileList[myFile][frm.elements[f].name] = '';
}
}
}catch(e){alert(e.message + " and the count is " + f);}
} ...
IF the above code doesn't show you what my problem is, then
I have added some more information (SKIP it if you don't need it).
Otherwise, continue reading...
The addFile function is called inside addRow() which is here:
//adds a DIV row with file link in innerHTML
addRow:function(){
if( this.max == 0 || this.elements.length <= this.max ){
current_element = this.elements.getLast();
// Create new row in files list
var name = current_element.element.value;
addFile(name);
[SNIP] ...
And, addRow is initialized below (called from the init function):
initializeElement:function( element ){
// What happens when a file is selected
element.addEvent(
'change',
function(){
this.addRow()
}.bind( this )
);