$config = array(
'db_table' => 'example', //The name of the table associated with this controller
'form_setup' => $this->spyc->YAMLLOAD($this->codexadmin->getDefinitionFileName('example_form')), //The array that holds our elements
'controller_name' => 'Example', //The name of the controller, so that it can be used when generating the URLs
'primary_key' => 'my_id', //The name of the controller, so that it can be used when generating the URLs
'display_fields'=>array('textbox_test','date_test','related_example'),
'rules'=>$rules
);
$this->setConfig($config);
}
function username_check($str)
{
if ($str == 'test')
{
$this->validation->set_message('username_check', 'The %s field can not be the word "test"');
return FALSE;
}
else
{
return TRUE;
}
}
}
?>
And the callback not work... Why?
Another small bug: the Select all link in the display mode not work...
[quote author="jTaby" date="1211413715"]abmcr, you want $this->CI->codexadmin->rules....codexadmin is a library in the CI object[/quote]
ok .... i have made this small feature for get a rule required indicator as in attached image
in the codexforms.php librarie insert this function
Code:
/*
* The function create a * symbol for a field with a rule required
*/
function required($field){
$this->CI = &get;_instance();
$required=NULL;
if (isset($this->CI->codexadmin->rules)){
if (array_key_exists($field,$this->CI->codexadmin->rules)) {
//search if a rule is 'required' in the rules
$rules=explode("|",$this->CI->codexadmin->rules[$field]);
$required=((in_array("required", $rules))?"<span class='required'>*</span>":NULL);
}
}
return $required;
}
after, in each plugin where you want the symbol change the lines