Where is the array - javascript? You can use the onUnload to post the array like a form...
Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)
I am creating the array server side based off of a DataRow. The array is getting passed to the client when the page loads and is formatted into a javascript Array() which fills a table based form. To eliminate the need for a ton of postbacks I am letting the user make changes to the table which in turn updates the array before refilling the table with new values.
I catch the onBeforeUnload event to pass the array back to the server when the page is closing but that is where I ran into a snag. As far as I know passing an array from client to server is much more work than from server to client.
I believe after scouring the net that the easiest way is the method posted here:
It depends on how the array is formatted. For instance if you know that the array has 10 fields and the first is name, the second is age and so forth you could do something like this...
function pageUnload(){
document.hiddenForm.myField.value = myFormArray.join("@#@#" //or some other obscure separator
document.hiddenForm.action = "formHandler.asp"
document.hiddenForm.method = "post"
document.hiddenForm.submit()
}
then on the form handler you just reform the array
dim formArr
formArr = split(request("myField", "@#@#"
Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)
Yes, the size and order of the array is static for this purpose at least. The method I found does a little bit more in the way of error checking and has more potential for customization but for the one instance I need to use this for your method is WAY easier and Faster. I had no idea there was a join and split method or what it did.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.