Click to See Complete Forum and Search --> : Posting Javascript Arrays


toucan
04-11-2003, 06:49 AM
Hi

I have a html page with a javascript array that i have coded.

I know how to post control arrays just can't work out how to get my array thats in the javascript code, posted with the form.

Any help would be appreciated.

Thanks

gil davis
04-11-2003, 06:54 AM
The easiest way would be to move the data into hidden form fields.

toucan
04-11-2003, 07:02 AM
My array is a two diemsional, how should I go about moveing the data into hidden inputs.

gil davis
04-11-2003, 07:33 AM
That would depend on how the data has to be passed in the post process. However, if you do this:
<script>var ary = new Array();
ary[0] = new Array("a","b");
ary[1] = new Array("c","d");
...
</script>
...
<form ... onsubmit="this.extra.value=ary">
<input type="hidden" name="extra">
</form>the resulting post would be?extra=a%2Cb%2Cc%2Cd