Regd:客户端验证 [英] Regd: client side validation

查看:66
本文介绍了Regd:客户端验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的浏览器中禁用了JavaScript插件(手动),(该网站具有JavaScript验证)



现在我的验证被跳过。如何解决这个问题?

if i've disabled the JavaScript addins in my browser(manually), (the web site has the JavaScript validation)

now my validation is skipped. how to over come this issue?

推荐答案

这里有2个选项,第一个是你可以要求网站用户使用JavaScript,这就是我的路线建议。



另一种方法是对表单的非JavaScript版本进行并行部署,这些版本具有更强大的服务器端验证。这通常是一个坏主意,无论如何你应该在服务器端进行强大的验证。



通常情况下,我会在主视图中设置一个嵌套页面,该页面将由AJAX调用,如果禁用JavaScript,则会显示错误。



例如,使用jQuery:

You have 2 options here, the first is that you can require site users to use JavaScript, and this is the route that I would suggest.

The other route is a parallel deployment of a non-JavaScript version of your forms that have more robust server-side validation. This is generally a bad idea, and you should have robust validation on the server side anyway.

Normally I'll setup a nested page in my primary view that will be called by AJAX, and can display an error instead if JavaScript is disabled.

For example, with jQuery:
<!DOCTYPE html>
<html>
    <head>
        ...
        <script type="text/javascript">


function (){


.ajax({
url:' 我的嵌套视图'
成功: function (data){
.ajax({ url: 'my nested view', success: function(data){


这篇关于Regd:客户端验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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