解析复杂的用户输入 [英] parsing complex user inputs

查看:53
本文介绍了解析复杂的用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述






我已经完成了用ASP编写的更新和维护网页

应用程序的任务和Javascript,它采用HTML格式的复杂

用户输入,并将它们提交到服务器端ASP

页面进行处理。问题是,用户输入可以变得非常复杂,以及这个应用程序的开发方式,输入都是串联成长串的

文本然后被提交为< hidden> HTML表单中的输入

并由服务器端ASP解析。这导致了可怕的字符串

一直在继续......

johnsmith~1232 ^ 01 ^是^否~~ | 43 | 4月


等等。这段代码难以维护和更新。

必须有更好的方法来做到这一点。我需要

在客户端的ASP页面中使用javascript和vbscript,

和用于处理服务器端数据的ASP页面。我不能用b $ b切换到不同的技术,或者使用.NET,或者像

这样的东西。我必须使用JS和VBScript来获取复杂而冗长的用户输入并提交它们进行处理。我想

以某种方式将这些输入存储在对象中,然后从这些对象中获取数据

,如果可能的话。


如果有人可以建议一个更好的方法来在javascript中完成所有这些

,即使只是为了指向正确的方向,我也会非常感激它。


sven

解决方案

" Sven Neuberg" <做******** @ nospampls.net>在消息中写道

新闻:kH ****************** @ twister.southeast.rr.com ...


您好,

我已经完成了更新和维护用ASP和Javascript编写的Web应用程序的任务,该应用程序在HTML中采用复杂的用户输入表单并将它们提交到服务器端ASP
页面进行处理。问题是,用户输入可能变得非常复杂,以及开发这个应用程序的方式,输入都被串联成文本的长字符串,然后被提交为<隐藏> HTML表单中的输入
并由服务器端ASP解析。这导致了一些可怕的字符串
johnsmith~1232 ^ 01 ^是^否~~ | 43 | 4月

等等。这段代码是一个维护和更新令人难以置信的痛苦。
必须有一个更好的方法来做到这一点。我需要在客户端的ASP页面中使用javascript和vbscript,以及在服务器端处理数据的ASP页面。我不能切换到不同的技术,或者使用.NET,或者像
那样的东西。我必须使用JS和VBScript来获取复杂和冗长的用户输入并提交它们进行处理。我想以某种方式将这些输入存储在对象中,然后在可能的情况下从这些对象中获取数据。

如果有人能提出更好的方法来完成所有这些操作
在javascript中,即使只是指向正确的方向,我也会非常感激。

sven




听起来用户填写了很多字段,并且在表单提交时,

将数据连接成一个(隐藏)字段,以便传递到

服务器,其中它被解析(可能使用Split()),验证,并且

处理。


一个选项是删除连接+解析并且只是通过服务器上的Request.Form(" fieldname)引用每个文件




是否在客户端进行了验证?


是否在客户端进行任何操作?


Sven Neuberg写道:
< blockquote class =post_quo测试>

我已经完成了更新和维护用ASP和Javascript编写的Web应用程序的任务,该应用程序采用HTML格式的复杂
用户输入将它们提交到服务器端ASP
页面进行处理。问题是,用户输入可能变得非常复杂,以及开发这个应用程序的方式,输入都被串联成文本的长字符串,然后被提交为<隐藏> HTML表单中的输入
并由服务器端ASP解析。这导致了一些可怕的字符串
johnsmith~1232 ^ 01 ^是^否~~ | 43 | 4月

等等。这段代码是一个维护和更新令人难以置信的痛苦。
必须有一个更好的方法来做到这一点。我需要在客户端的ASP页面中使用javascript和vbscript,以及在服务器端处理数据的ASP页面。我不能切换到不同的技术,或者使用.NET,或者像
那样的东西。我必须使用JS和VBScript来获取复杂和冗长的用户输入并提交它们进行处理。我想以某种方式将这些输入存储在对象中,然后在可能的情况下从这些对象中获取数据。


每个人都希望能够序列化客户端JavaScript

对象并将它们发送到服务器,遗憾的是HTTP无法工作

那样。要将数据提供给服务器,您必须发出HTTP

请求(通常是GET或POST)。你可以发送到服务器唯一的东西是带有GET或POST的
是HTTP头(客户端JavaScript没有使用XML HTTP Request对象就没有访问
) )和URL本身。


因此,在某些时候,您需要将复杂的数据结构转换为

分隔文本或附加到多个属性的文本,或者什么,

来把它送到服务器。


XML HTTP Request对象不会改变这个,除了它给你

能够在没有< form>的情况下发送自定义HTTP标头和POST数据。

如果有人可以建议一个更好的方法在javascript中完成所有这些,甚至只是指向我正朝着正确的方向前进,我会非常感激。




如果您正在尝试将复杂的客户端数据结构移动到

服务器,唯一的方法是序列化通过做你必须维护的网站的前任作者所做的事情,然后

从序列化的服务器重建服务器上的数据结构。数据

(分隔字符串)。


-

Grant Wagner< gw ***** @ agricoreunited.com> ;

comp.lang.javascript常见问题 - http://jibbering.com/常见问题


2004年10月25日星期一21:15:57 GMT,在comp.lang.javascript中你写道:

Sven Neuberg写道:

每个人都希望能够序列化客户端JavaScript
对象并将它们发送到服务器,遗憾的是HTTP并不是工作
那样。要将数据提供给服务器,您必须发出HTTP请求(通常是GET或POST)。您可以通过GET或POST发送到服务器的唯一事情是HTTP标头(客户端JavaScript无法使用XML HTTP Request对象访问它)和URL本身。




如何使用WDDX来缓解解析难题?


Jamie



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

解决方案

"Sven Neuberg" <do********@nospampls.net> wrote in message
news:kH******************@twister.southeast.rr.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+parsing 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*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq


On Mon, 25 Oct 2004 21:15:57 GMT, in comp.lang.javascript 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


这篇关于解析复杂的用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆