add a 'save_callback' entry in your field definition:
Code:
'myfield' => array
(
'label' =>...,
'inputType' => 'text',
'save_callback' => array
(
array('myclass', 'checkUniqueness')
)
then create the callback
Code:
class myclass extends Backend {
public function __construct() {
parent::__construct();
$this->import('Database');
}
public function checkUniqueness($varValue, DataContainer $dc) {
// value check goes here
if ($recordExists) {
throw new Exception('field must be unique');
}
return $varValue
}
}
hope this helps
Bookmarks