arrayexist Validate an Array of Foriegn Keys Exist

  1. Requirements
  2. Usage
  3. Resources

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.

Resources

2 0
1 follower
415 downloads
Yii Version: 1.1
License: MIT
Category: Validation
Developed by: Loren
Created on: May 12, 2011
Last updated: 9 years ago

Downloads

show all

Related Extensions