[eluser]jpschroeder[/eluser]
I dynamically process forms that are submitted. This means that I may submit a form that doesn't have any validation written for it yet, but I will still try to load a rule group. For example:
Code:
function handle_form($table){
if($this->form_validation->run($table) == false){
//validation failed so do these things...
// check to see if there was a rule group for this table...
if($this->config->item($table)){ // <--- the line I don't know the proper code for...
echo validation_errors();
}else{
echo "no form validation set yet, please make one before continuing";
}
}else{
//validation passed, handle the data...
}
}
config/form_validation.php:
Code:
$config = array(
'users' => array(
array(
"field" => "first_name",
"label" => "First Name",
"rules" => "required"
),
array(
"field" => "last_name",
"label" => "Last Name",
"rules" => "required"
)
)
);
Now the validation works just fine if there is a rule set for the $table. But if there isn't a rule group set, the validation doesn't pass, which is good, but I want to know that it failed because there wasn't a rule group set. In order to do that I have to be able to somehow check to see if that rule group exists. Can someone please let me know to access the $config variable set in config/form_validation.php? I thought this would work:
Code:
if($this->config->item('rule_group'))
but it just returns false every time even when the group exists. Thanks in advance!
Thanks in advance