Elliot Cater
Member
Hi
I'm trying to add an extra validation rule to the the 'Lists' model so I can use the extra field I'm adding in the database for my extension.
Can someone tell me the correct way to go about this? I've tried extending the Lists model and creating the $rules method like below:
$list->rules() just displays the original array from the Lists model
Would really appreciate a little help here - I may be going about this the wrong way!
Cheers
Elliot
I'm trying to add an extra validation rule to the the 'Lists' model so I can use the extra field I'm adding in the database for my extension.
Can someone tell me the correct way to go about this? I've tried extending the Lists model and creating the $rules method like below:
Code:
class MyCrazyExtCommon extends Lists
{
public function rules()
{
$rules = array(
array('mycrazy_field', 'in', 'range' => array_keys($this->getYesNoOptions())),
);
return CMap::mergeArray($rules, parent::rules());
}
}
$list->rules() just displays the original array from the Lists model
Would really appreciate a little help here - I may be going about this the wrong way!
Cheers
Elliot
Last edited: