繁琐的表单验证的最佳解决方案? [英] Best solution to tedious form validation?

查看:70
本文介绍了繁琐的表单验证的最佳解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在会员表上工作了一段时间,并且发现它非常难以获得可接受的表单验证级别。网上搜索

解决方案揭示了一些自制的解决方案,例如:

http://simonwillison.net/2003/Jun/17/theHolyGrail/
http://samuelsjoberg.com/archive/200...ent-and-server


从第一个链接引用,这是我对从用户角度来看的表单验证的想法




1.显示表格;你填写它。

2.你将表格提交给服务器。

3.如果你错过了什么或提供了无效的输入,表格是

重新显示预填充您已输入的有效数据。

4.重新显示的表单会告诉您错误。它还标记

字段不正确。

5.循环直到你正确填写表格。


在我的会员表格,我发现这很复杂,容易出错

,如果在PHP中手工编码,则会很乏味。另外,我发现从它出来的代码中可以重复使用很少的

。必须有一个更好的方法...


我手工编码,但在这种情况下,我可以提供最高效的
环境想象一下将是一个WYSIWYG IDE环境,你可以在这里绘制表单并从下拉列表中选择大多数属性。 IDE

然后会为您生成所有代码,并提供给FTP到

的正确位置。我相信这就是微软希望用ASP.NET中的Web Forms实现的
。那里的大缺点(纠正我,如果我是错误的b $ b)是ASP.NET表单只适用于IIS服务器和IE客户端。

有什么像ASP.NET Web表单,但更少以MS为中心,并使用

PHP代码?如果没有,那么下一个最佳解决方案是什么?


非常感谢提前。


Gustaf

解决方案

2007年10月26日消息< mZ ********************* @ giganews.comGustaf

写道:


>我全都是手工编码,但在这种情况下,最有效率的环境我可以想象将是一个WYSIWYG IDE环境,您可以在其中绘制表单并从下拉列表中选择大多数属性。然后,IDE将为您生成所有代码,并将其提供给FTP到正确的位置。



是的,请你写下我会买的:-)


-

Jeff Gaines Damerham Hampshire UK

当你能够维持生计时,他们会移动两端


" Jeff Gaines" < jg ************ @ yahoo.co.ukwrote in message

news:xn *************** @ news.individual.net ...


2007年10月26日消息< mZ *************** ******@giganews.comGustaf

写道:


>>我全都是手工编码,但在这种情况下,我能想象的最高效的环境将是WYSIWYG IDE环境,您可以在其中绘制表单并从下拉列表中选择大多数属性。然后,IDE将为您生成所有代码,并将其提供给FTP到正确的位置。



是的,请你写的我会买的:-)



它''这个名为Visual Studio.net,它可以在任何地方获得大约五美元一两百美元。

ASP.net有一整套写作表格 - 验证码,服务器和

客户端。

它非常复杂,但它确实有效。



2007年10月26日消息< 02 ***************** @newssvr21.news.prodigy.net>

Sanders Kaufman写道:


>" Jeff Gaines" < jg ************ @ yahoo.co.ukwrote in message
新闻:xn *************** @ news.individual。 net ...


>> 2007年10月26日消息< mZ *************** ******@giganews.comGustaf
写道:


>>>我全都是手工编码,但是在这种情况下,我能想象的最高效的环境将是一个WYSIWYG IDE环境,您可以在其中绘制表单并从下拉列表中选择大多数属性。然后,IDE将为您生成所有代码,并将其提供给FTP到正确的位置。


是的,请你写的我会买的:-)


它叫做Visual Studio.net而且它几乎可以在任何地方获得五百到一千美元。
ASP.net有一整套用于编写表单验证代码,服务器和客户端的工具。
它非常复杂,但它确实有效。



我是MSDN订阅者,在VS 2005中没有发现任何可能是/ b $ b被称为HTML的体面可视化IDE,当然没有提到

php。事实上Kompozer是一个比VS更好的WYSIWYG IDE :-(


我很想被证明是错的,但我甚至无法指定
$ b的位置$ b中的Web组件没有手工编写。


-

Jeff Gaines Damerham Hampshire英国

我可以请每天只有一个人。今天不是你的一天。

明天,看起来也不好。


I''ve been working on a membership form for a while, and find it very
tedious to get an acceptable level of form validation. A web search for
solutions revealed some home-brewed solutions, such as these:

http://simonwillison.net/2003/Jun/17/theHolyGrail/
http://samuelsjoberg.com/archive/200...ent-and-server

Quoting from the first link, this is my idea of what form validation is
like from the user''s perspective:

1. The form is displayed; you fill it in.
2. You submit the form to the server.
3. If you missed something out or provided invalid input, the form is
redisplayed pre-filled with the valid data you already entered.
4. The redisplayed form tells you what you got wrong. It also flags
the fields that were incorrect.
5. Loop until you fill the form in correctly.

In my membership form, I''ve found this to be complicated, error-prone
and tedious if coded by hand in PHP. Plus, I find that very little of
the code that comes out of it can be reused. There must be a better way...

I''m all for coding by hand, but in this case, the most productive
environment I can imagine would be a WYSIWYG IDE environment, where you
draw the form and pick most properties from drop-down lists. The IDE
would then generate all the code for you, and offer to FTP it to the
right location. I believe this is what Microsoft wanted to accomplish
with Web Forms in ASP.NET. The big drawback there (correct me if I''m
wrong) is that ASP.NET forms only work on IIS servers and IE clients. Is
there anything like ASP.NET Web forms, but less MS-centric, and using
PHP code? If not, what''s the next best solution?

Many thanks in advance.

Gustaf

解决方案

On 26/10/2007 in message <mZ*********************@giganews.comGustaf
wrote:

>I''m all for coding by hand, but in this case, the most productive
environment I can imagine would be a WYSIWYG IDE environment, where you
draw the form and pick most properties from drop-down lists. The IDE would
then generate all the code for you, and offer to FTP it to the right
location.

Yes please, you write it I''ll buy it :-)

--
Jeff Gaines Damerham Hampshire UK
By the time you can make ends meet they move the ends


"Jeff Gaines" <jg************@yahoo.co.ukwrote in message
news:xn***************@news.individual.net...

On 26/10/2007 in message <mZ*********************@giganews.comGustaf
wrote:

>>I''m all for coding by hand, but in this case, the most productive
environment I can imagine would be a WYSIWYG IDE environment, where you
draw the form and pick most properties from drop-down lists. The IDE would
then generate all the code for you, and offer to FTP it to the right
location.


Yes please, you write it I''ll buy it :-)

It''s called Visual Studio.net and it''s availabe most anywhere for about five
hundred to a thousand bucks.
ASP.net has a whole facility for writing form-validation code, server and
client side.
It''s wildly complex, but it works.



On 26/10/2007 in message <02*****************@newssvr21.news.prodigy.net>
Sanders Kaufman wrote:

>"Jeff Gaines" <jg************@yahoo.co.ukwrote in message
news:xn***************@news.individual.net...

>>On 26/10/2007 in message <mZ*********************@giganews.comGustaf
wrote:

>>>I''m all for coding by hand, but in this case, the most productive
environment I can imagine would be a WYSIWYG IDE environment, where you
draw the form and pick most properties from drop-down lists. The IDE would
then generate all the code for you, and offer to FTP it to the right
location.


Yes please, you write it I''ll buy it :-)


It''s called Visual Studio.net and it''s availabe most anywhere for about
five hundred to a thousand bucks.
ASP.net has a whole facility for writing form-validation code, server and
client side.
It''s wildly complex, but it works.

I am an MSDN subscriber and have found nothing in VS 2005 that could be
called a decent visual IDE for HTML, and of course there is no mention of
php. In fact Kompozer is a better WYSIWYG IDE than VS :-(

I would love to be proved wrong, but I can''t even specify the location of
web components in VS without coding it by hand.

--
Jeff Gaines Damerham Hampshire UK
I can please only one person per day. Today is not your day.
Tomorrow, isn''t looking good either.


这篇关于繁琐的表单验证的最佳解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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