Yii Framework Forum: Conditional Validation - Yii Framework Forum

Jump to content

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

Conditional Validation Rate Topic: -----

#1 User is offline   maggi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 30-November 11

Posted 07 August 2012 - 11:56 AM

I have AutoFlag and ScriptId fileds in a table.

In the form AutoFlag is a checkbox and ScriptID field is a drop down.



I need to put a validation on ScriptID.

If AutoFlag is checked in the form then ScriptID cannot be blank. Use must select the ScriptID.

If AutoFlag is not checked then need not validate for ScriptID.
0

#2 User is offline   riemann 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 31-August 11
  • Location:Algeria

Posted 07 August 2012 - 01:16 PM

Hi,
Sadely you can't do it with validator's present in the core of yii but there a are extensions who do it
econditionalvalidator
or
yii-conditional-validator

or if you want to learn more about how to do your own validator you can read
create your own validation rule

Good luck for next.
0

#3 User is offline   maggi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 30-November 11

Posted 07 August 2012 - 02:07 PM

Thanks riemann,

I got this working through Yii-conditional-validator.
0

#4 User is offline   riemann 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 31-August 11
  • Location:Algeria

Posted 07 August 2012 - 05:46 PM

Good for you ^_^
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