CakePHP验证规则匹配field1和field2 [英] CakePHP validation rule to match field1 and field2

查看:138
本文介绍了CakePHP验证规则匹配field1和field2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行密码重设表单,其中包含两个栏位:password1和password2。用户输入他们的新密码,然后重新输入他们的新密码。

I am making a password reset form, which contains two fields: password1 and password2. The user enters their new password and then re-types their new password again.

我不知道如何做一个验证规则,将比较两个值从

I'm not sure how to make a validation rule that will compare the two values from the fields and see if they're the same.

推荐答案

要比较2个字段,您需要编写自定义验证规则: http://bakery.cakephp.org/articles/aranworld/2008/01/14/using-equalto-validation-to-compare-two-form-fields (阅读评论,因为教程本身是旧的)

To compare 2 fields, you need to write a custom validation rule: http://bakery.cakephp.org/articles/aranworld/2008/01/14/using-equalto-validation-to-compare-two-form-fields (read the comments also, because the tutorial itself is kind of old)

这篇关于CakePHP验证规则匹配field1和field2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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