以什么方式$('#myelement')。valid();作品 [英] In what way $('#myelement').valid(); works

查看:67
本文介绍了以什么方式$('#myelement')。valid();作品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



想知道$('#myelement')。有效();功能有效,我的意思是它验证什么,什么规则什么消息等。这些规则在哪里配置。



谢谢

问候

Chandrashekhar Rai

解决方案

('#myelement')。valid();功能有效,我的意思是它验证什么,什么规则什么消息等。这些规则在哪里配置。



谢谢

问候

Chandrashekhar Rai






有关jQuery验证插件的信息,请查看 jQuery验证插件文档 [ ^ ]。



来自文档:

。valid()

描述:检查所选表单是否有效或是否所有选中元素是有效的。





...希望它有帮助


除了解决方案1- 2:



我希望你能在客户端部分验证成功。但是如果合理地使用某种形式并对其进行验证,则应将表单数据提交给服务器端,否则使用表单几乎没有意义。但是,您需要了解如果安全性存在问题,客户端验证绝对不够。如果安全性可能被客户端数据泄露,恶意艺术家可以轻松地,非常容易地绕过您的验证。



所以,您始终需要在服务器端验证/清理此类数据。我解释了现实生活中可能发生的事情,如果你没有这样做,仅举一个现实生活中的例子,在我过去的答案中:无法发送邮件,它显示以下代码中的错误。 [ ^ ]。 />


请将其视为严重的安全警告



- SA

Hi,
Want to know how $('#myelement').valid(); function works , I mean what does it validate, what rules what messages etc . Where are those rules configured.

Thanks
Regards
Chandrashekhar Rai

解决方案

('#myelement').valid(); function works , I mean what does it validate, what rules what messages etc . Where are those rules configured.

Thanks
Regards
Chandrashekhar Rai


Hi,

For information on the jQuery validation plugin, have a look at the jQuery Validation Plugin Documentation[^].

From the documentation:

.valid()

Description: Checks whether the selected form is valid or whether all selected elements are valid.



... hope it helps


In addition to Solutions 1-2:

I hope you will succeed in validation on the client part. But if you reasonably use some form and validated it, you should submit the form data to the server side, otherwise the use of the forms makes little to no sense. But then you need to understand that client-side validation is absolutely insufficient if security is an issue. In case when security can be possibly compromised by the client data, the malicious artist can easily, very easily bypass your validation.

So, you always need to validate/sanitize such data on server side. I explained what can happen in real life if you fail to do so, on just one real-life example, in my past answer: unable to send mail , it showing the error in below code .[^].

Please consider it as a serious security warning.

—SA


这篇关于以什么方式$('#myelement')。valid();作品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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