An array exist validator.
Yii 1.1 or above (Tested Yii 1.1.7)
Unzip arrayExist folder in /protected/extensions/ Add to the Rules array in Model:
array('field', 'ext.arrayExist.arrayExist', 'className' => 'foriegnkeyclass', 'attributeName' => 'foriegnkeyattribute'),
You may wish to add beforeSave and afterFind methods to implode/explode the array/string. (Note: You should really be using a second table to handle the foreign keys not a comma separated array. This was invented for a contact form to ensure they selected valid items from our list.
You may want to use this with the EMultiSelect widget.
Be the first person to leave a comment
Please login to leave your comment.