对服务器上的数据进行Javascript验证 [英] Javascript validation against data on server

查看:56
本文介绍了对服务器上的数据进行Javascript验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好Javascript专家,


我在Javascript世界中相对较新。我有一个问题要解决,

我希望你们中的一个可以帮助我。


我正在构建验证系统,即我想验证输入的数据使用

普通的HTML表格。将使用Javascript脚本检查数据

立即获得状态,并防止用户在出现错误时继续使用。


但是一些数据必须是检查通过

PHP脚本访问的MySql数据库。这些PHP验证发生在用户点击< submit>之后按钮。


我想从服务器检索MySql数据并将它们用于客户端工作站上的即时Javascipt验证




任何人都可以告诉我是否有可能,如果是的话,实施的编码是什么。

这样的程序将避免所有验证 - 反对日期待定义

两次,一次在他们所在的服务器上,一次重复所有

必要的Javascript。


谢谢非常感谢您的宝贵帮助和最好的问候


RCB845

解决方案

rc **** @ yahoo.fr 说:

这样的程序会避免全部验证 -date"待定义
两次,一次在他们所在的服务器上,一次在所有必要的Javascript中重复。




不,它不会''真的。客户端的验证应该仅为用户提供便利。你的真实必须始终在服务器上进行验证,

您可以在其中控制环境。对于用户来说太容易关闭

Javascript,或者是恶意的人故意绕过客户端

验证。


Lee写道:

rc **** @ yahoo.fr 说:

这样的程序将避免所有验证 - 反对日期。待定义
两次,一次在他们所在的服务器上,一次在所有必要的Javascript中重复。



不,它不会,真的。客户端的验证应仅为用户提供方便。你的真实必须始终在服务器上进行验证,
您可以在其中控制环境。用户很容易关闭Javascript,或者让恶意的人故意绕过客户端验证。




但是,您可以使用javascript和隐藏字段设置一个标志,这将减少服务器的处理时间。


if(


flag){//它已被标记}

else {执行验证}


Mick。

Hi everybody Javascript specialist,

I am relatively new in Javascript world. I have a problem to solve and
I hope one of you can help me.

I am building a validation system, i.e. I want to validate data entered using
A normal HTML FORM. Data will be checked using Javascript scripts to
Have an immediate status, and to prevent user to keep on in case of error.

But some data must be checked against MySql database accessed through
PHP scripts. These PHP validate occur after user has hit <submit> button.

I would like to retrieve MySql data from server and have them available for
Immediate Javascipt validation on the client workstation.

Can anyone tell me if it is possible, and if yes, what is the coding to implement.
Such procedure would avoid having all "validation-against-date" to be defined
Twice, once on the server where they reside, and once duplicated in all
Necessary Javascript.

Thank you very much for your precious help and best regards

RCB845

解决方案

rc****@yahoo.fr said:

Such procedure would avoid having all "validation-against-date" to be defined
Twice, once on the server where they reside, and once duplicated in all
Necessary Javascript.



No it wouldn''t, really. Validation on the client side should be for the user''s
convenience, only. Your "real" validation must always be done on the server,
where you can control the environment. It''s too easy for a user to turn off
Javascript, or for a malicious person to intentionally bypass client side
validation.


Lee wrote:

rc****@yahoo.fr said:

Such procedure would avoid having all "validation-against-date" to be defined
Twice, once on the server where they reside, and once duplicated in all
Necessary Javascript.


No it wouldn''t, really. Validation on the client side should be for the user''s
convenience, only. Your "real" validation must always be done on the server,
where you can control the environment. It''s too easy for a user to turn off
Javascript, or for a malicious person to intentionally bypass client side
validation.



You may, however, set a flag using javascript and a hidden field that
would decrease processsing time for the server.

if(


flag) {//it''s vaidated }
else { perform validation }

Mick.


这篇关于对服务器上的数据进行Javascript验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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