Yii Framework Forum: Ar属性验证器如何进行动态验证? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ar属性验证器如何进行动态验证? Rate Topic: -----

#1 User is offline   wolf_need 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-February 12

Posted 03 November 2013 - 12:14 AM

我的AR中有一个属性的字段值是由多个input值组合而成。并且每次input的数量都是不一样的,也就是说是动态的。我应该如何验证这组input中的每个值? :rolleyes:
0

#2 User is offline   巡洋艦 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 316
  • Joined: 18-December 09
  • Location:Beijing, China

Posted 07 November 2013 - 05:41 AM

可以使用自定义验证器
0

#3 User is offline   jarlyyn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 01-November 12

Posted 15 November 2013 - 04:50 AM

定义一个函数,参数为$model和$attribure,判断各属性,给没通过验证的属性addError.
把函数名作为rule名
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users