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.
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.
sven 11 2096
"Sven Neuberg" <do********@nos pampls.net> wrote in message
news:kH******** **********@twis ter.southeast.r r.com... 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.
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.
sven
It sounds like the user fills in numerous fields and, on form submission,
the data is concatenated into a single (hidden) field for passing to the
server where it is parsed (perhaps using "Split()"), validated, and
processed.
One option is remove the concatenation+p arsing and just refer to each file
via "Request.Form(" fieldname") on the server.
Is any validation done on the client-side?
Is any manipulation done on the client-side?
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 <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
On Mon, 25 Oct 2004 21:15:57 GMT, in comp.lang.javas cript you wrote: Sven Neuberg wrote:
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.
What about using WDDX to ease the parsing woes?
Jamie
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:4Zcfd.3047 07$MQ5.33947@at tbi_s52... It sounds like the user fills in numerous fields and, on form submission, the data is concatenated into a single (hidden) field for passing to the server where it is parsed (perhaps using "Split()"), validated, and processed.
Yes, and not only that, there could be a dozen "sets" of this information,
all in one very long hidden field.
One option is remove the concatenation+p arsing and just refer to each file via "Request.Form(" fieldname") on the server.
I'm not sure what you mean, sorry.
Is any validation done on the client-side?
Yes, quite a bit.
Is any manipulation done on the client-side?
Yes, because the user may choose to go back and edit some of the
fields, so there is quite a bit of parsing of the strings going on.
thank you,
sven
"Jamie Jackson" <mc************ *************@h otmail.com> wrote in message
news:hl******** *************** *********@4ax.c om...
What about using WDDX to ease the parsing woes?
Jamie
I have never heard of it, but now I am looking at www.openwddx.org to
see if it will help. Thank you for the suggestion.
sven
"Sven Neuberg" <do********@nos pampls.net> skrev i meddelandet
news:kH******** **********@twis ter.southeast.r r.com... 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
<snip>
What happens if a user inputs one of the delimiting characters ("Joh|n
Smi~th")?
That problem is solved if you write Javascript to serialize/unserialize
arrays, and the same code in your server-side language.
For instance, say you collect form values into an array like:
var theThing = new Array("johnsmit h", "Yes", 1232);
You could convert this into something like:
Array{key sz:1{0} string sz:9{johnsmith} key sz:1{1} string sz:3{Yes} key
sz:1{2} int sz:4{1232}}
You post it to the server, which reconstitutes the array. This would work
regardless of the input values and it's a bit easier to maintain.
Joakim Braun
Joakim Braun wrote: "Sven Neuberg" <do********@nos pampls.net> skrev i meddelandet news:kH******** **********@twis ter.southeast.r r.com... 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
<snip>
What happens if a user inputs one of the delimiting characters ("Joh|n Smi~th")?
That problem is solved if you write Javascript to serialize/unserialize arrays, and the same code in your server-side language.
For instance, say you collect form values into an array like: var theThing = new Array("johnsmit h", "Yes", 1232);
You could convert this into something like: Array{key sz:1{0} string sz:9{johnsmith} key sz:1{1} string sz:3{Yes} key sz:1{2} int sz:4{1232}}
You post it to the server, which reconstitutes the array. This would work regardless of the input values and it's a bit easier to maintain.
Joakim Braun
One last note about this, the Object#toSource () method is well-suited to the
task of serializing your object. Try the following code in any Gecko-based
browser (Firefox, Mozilla, Netscape 7+):
var o = new Object();
o.a = 1;
o.b = '2';
o.c = new Object();
o.c.d = 3;
o.c.e = '4';
alert(o.toSourc e());
Unfortunately, toSource() isn't supported in IE. :(
--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
"Joakim Braun" <jo**********@j fbraun.removeth is.com> wrote in message
news:zk******** ********@nntpse rver.swip.net.. .
For instance, say you collect form values into an array like: var theThing = new Array("johnsmit h", "Yes", 1232);
You could convert this into something like: Array{key sz:1{0} string sz:9{johnsmith} key sz:1{1} string sz:3{Yes} key sz:1{2} int sz:4{1232}}
You post it to the server, which reconstitutes the array. This would work regardless of the input values and it's a bit easier to maintain.
Thank you! I am going to look into this. It looks like it could be very
helpful.
sven
"Grant Wagner" <gw*****@agrico reunited.com> wrote in message
news:41******** *******@agricor eunited.com...
Unfortunately, toSource() isn't supported in IE. :(
Unfortunately, IE is our target browser, and it is a decision that is
out of my control. :(
sven This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: YoBro |
last post by:
Hi
I have used some of this code from the PHP manual, but I am bloody hopeless
with regular expressions.
Was hoping somebody could offer a hand.
The output of this will put the name of a form field beside name.
I want to get the following but not sure how to modify the code below.
1. Field Name (to appear beside NAME:)
2. Field Type (to appear beside TYPE:)
|
by: Gerrit Holl |
last post by:
Posted with permission from the author.
I have some comments on this PEP, see the (coming) followup to this message.
PEP: 321
Title: Date/Time Parsing and Formatting
Version: $Revision: 1.3 $
Last-Modified: $Date: 2003/10/28 19:48:44 $
Author: A.M. Kuchling <amk@amk.ca>
Status: Draft
Type: Standards Track
|
by: ARK |
last post by:
I am writing a search program in ASP(VBScript). The user can enter keywords
and press submit.
The user can separate the keywords by spaces and/or commas and key words may
contain plain words, single quoted strings (phrases), double quoted strings
(phrases).
For example:
Keywords:
Jack, Jill, Jim, "Timothy Brown", Mary OR
|
by: Pir8 |
last post by:
I have a complex xml file, which contains stories within a magazine. The
structure of the xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<magazine>
<story>
<story_id>112233</story_id>
<pub_name>Puleen's Publication</pub_name>
<pub_code>PP</pub_code>
<edition_date>20031201</edition_date>
|
by: Earl |
last post by:
I'm curious if there are others who have a better method of
accepting/parsing phone numbers. I've used a couple of different techniques
that are functional but I can't really say that I'm totally happy with
either.
1. My first technique was to restrict the users to entries that could only
be 3 character, 3 characters, 4 character (area code, prefix, suffix,
respectively). I would null out any inputs that were non-numeric (except the...
| |
by: Tony |
last post by:
I'm wondering if anyone has run any tests to compare the speed of
parsing XML vs text in simple lists - such as:
<?xml version="1.0" encoding="ISO-8859-1"?>
<users>
<user>User 1</user>
<user>User 2</user>
<user>User 3</user>
</users>
|
by: gamehack |
last post by:
Hi all,
I was thinking about parsing equations but I can't think of any generic
approach. Basically I have a struct called math_term which is something
like:
struct math_term {
char sign;
int constant;
int x;
int y;
|
by: davebaty |
last post by:
I'm relatively new to VB programming (VB 2005), and have come across a problem parsing complex text files. Basically I have a file which has lines something like the following:
max_gross_weight = 150000 // (pounds)
empty_weight = 74170 // (pounds)
max_number_of_stations = 50
station_load.0 = "170.0, 41.0, -1.5, 0.0, Pilot" //Weight (lbs),
station_load.1 = ...
|
by: nine72 |
last post by:
Ok, I am at a complete loss on this and have finally come to the XML Parsing Gods (and perhaps a PHP minor deity) for guidance…
I will try my best to describe what I have going on…
1) I have 15 form pages, well over 500 potential fields, which are written in PHP. While most pages are one time entry forms, there are 5 that can be “recycled” as many times as needed. An example would be the Contacts Form. A user can give me 1 contact and move...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |