An array exist validator.
Requirements ¶
Yii 1.1 or above (Tested Yii 1.1.7)
Usage ¶
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.
User Contributed Notes
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.