求助,模型的困惑
时间:2011-06-08
来源:互联网
请高人帮忙解决两个模型上的困惑
1、同一字段的必须(require)和唯一(unique)怎么才能同时验证?
2、在同一模版同时使用了自动验证,自动完成,字段映射,create()方法可以写入,但不可以更新,代码如下
复制代码
1、同一字段的必须(require)和唯一(unique)怎么才能同时验证?
2、在同一模版同时使用了自动验证,自动完成,字段映射,create()方法可以写入,但不可以更新,代码如下
- class TypeModel extends CommonModel {
- protected $_validate = array(
- array('note','require','项目不能为空!'),
- array('note','','项目已经存在!',0,'unique',1),
- );
- protected $_map = array(
- // 'hiddenField'=>'id',
- 'textfield' =>'note',
- 'textfield2' =>'intr',
- 'select3' =>'whether',
- );
- //日期和时间合并定入
- public $_auto = array (
- array('starttime','start_time',3,'callback'),
- array('endtime','end_time',3,'callback'),
- );
- public function start_time(){
- $rs = $this->get_parse($_POST['datepicker'].$_POST['select']);
- return $rs;
- }
- public function end_time(){
- $rs = $this->get_parse($_POST['datepicker2'].$_POST['select2']);
- return $rs;
- }
- public function get_parse($act){
- import("ORG.Util.Date");
- $da = new Date();
- $rs = $da->parse($act );
- return $rs;
- }
-
- }
作者: httpwww372 发布时间: 2011-06-08
没人来指点下吗
作者: httpwww372 发布时间: 2011-06-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28