Sven Neuberg wrote:
> Hi,
>
> I have been handed the task of updating and maintaining a web
> application, written in ASP and Javascript, that takes complex
> user inputs in HTML form and submits them to server-side ASP
> pages for processing. The problem is, the user inputs can
> become very complex, and the way this application was developed,
> the inputs are all concatenated into monstrously long strings
> of text that are then submited as <hidden> inputs in HTML forms
> and parsed by the server-side ASP. This results in hideous strings
> that go on and on like
> johnsmith~1232^01^Yes^no~~|43|april
>
> etc. etc. This code is an incredible pain to maintain and update.
> There has got to be a better way to do this. I am required to
> use javascript and vbscript in ASP pages on the client side,
> and ASP pages for processing data on the server side. I can't
> switch to a different technology, or use .NET, or anything like
> that. I have to use JS and VBScript to get intricate and lengthy
> user inputs and submit them for processing. I would like to
> store these inputs in objects somehow and then get the data
> from those objects, if possible.
Everyone would like to be able to serialize client-side JavaScript
objects and send them to the server, unfortunately HTTP doesn't work
that way. To get the data to the server, you have to make an HTTP
request (usually GET or POST). The only thing you can send to the server
with a GET or POST are HTTP headers (which client-side JavaScript has no
access to without using the XML HTTP Request object) and the URL itself.
So at some point, you need to turn your complex data structure into
delimited text, or text attached to multiple attributes, or something,
to get it to the server.
The XML HTTP Request object does not change this, except it gives you
the ability to send custom HTTP headers and POST data without a <form>.
> If anyone could suggest a better method for doing all of this
> in javascript, even just to point me in the right direction, I would
> greatly appreciate it.
If you are trying to move complex client-side data structures to the
server, the only way to do it is to "serialize" it by doing what the
previous author of the site you must maintain has done, and then
reconstruct the data structure on the server from the "serialized" data
(delimited strings).
--
Grant Wagner <>
comp.lang.javascript FAQ -
http://jibbering.com/faq