Hi,
I am trying to create an array of arrays in Javascript to hold data on a set of data from a form of an unknown size. This is what I have so far:
This works perfectly, except if I replace ftWrapper[1] in the last line with ftWrapper[1][1], I get no output and a script error (At the moment I get the contents of Values seperated with commas)... I have no idea why.
Can anyone tell me where I am going wrong please?
Thanks
I am trying to create an array of arrays in Javascript to hold data on a set of data from a form of an unknown size. This is what I have so far:
PHP:
<script>
$(document).ready(function(){
var formTypes=new Array("GlobCol","CoOrd");
var fTWrapper=new Array();
for ( var i=0, len=formTypes.length; i<len; ++i ){
var input= $("input[name^=" + formTypes[i] + "]");
var multipleValues = $("input[name^=" + formTypes[i] + "]").val();
var values=new Array();
for (x=1; x<=input.length; x++)
{
values[x]=$("input[name^=" + formTypes[i] + x + "]").val();
}
fTWrapper[i]=values;
$("div").text("For the field type"+ formTypes[i] +" jQuery found.."+ input.length +"."+fTWrapper[1]+" and " +x+ " elements in the array. Last Testing.." + values[5]);
}
});
</script>
This works perfectly, except if I replace ftWrapper[1] in the last line with ftWrapper[1][1], I get no output and a script error (At the moment I get the contents of Values seperated with commas)... I have no idea why.
Can anyone tell me where I am going wrong please?
Thanks
Last edited:
