Tuesday, August 9, 2011

Linked Required Fields

This came up today as something that is a very basic requirement when developing complex forms, but there was no way built in to Yii to handle it quickly and consistently across multiple models, so I created a custom validator for it. I hope it helps others to move forward quickly with their complex form development ;)


The need was that when a specific field was set or a specific value was selected for a field, additional fields would become required.

The solution? ChildrenRequiredValidator


http://www.yiiframework.com/extension/childrenrequiredvalidator/

Any feedback or suggestions are more than welcome!