El Forum
07-08-2012, 09:23 AM
[eluser]BenAbrams[/eluser]
Hi Guys
I have a custom field validation rule in a config file set up, something similar to to the below:
A very simple function in my controller below just checks the input and provides a custom error message
I wanted to make the function above 'private' so it couldn't be accessed by the URI but obviously this prevents the helper from accessing the function. I cant add the underscore to the function name because the callback doesn't seem to accept it. I was thinking of using the _remap function to send 'check_terms' in the uri to the 404 but this seems a little overkill.
Can anyone suggest a more elegant solution?
Hi Guys
I have a custom field validation rule in a config file set up, something similar to to the below:
Code:
array(
'field' => 'check_terms',
'label' => 'Terms of service',
'rules' => 'callback_check_terms'
)
A very simple function in my controller below just checks the input and provides a custom error message
Code:
public function check_terms($terms=0){
if ($terms != 'agree')
{
$this->form_validation->set_message('check_terms', 'The terms of service must be read and agreed to before continuing.');
return FALSE;
}
else
{
return TRUE;
}
}
I wanted to make the function above 'private' so it couldn't be accessed by the URI but obviously this prevents the helper from accessing the function. I cant add the underscore to the function name because the callback doesn't seem to accept it. I was thinking of using the _remap function to send 'check_terms' in the uri to the 404 but this seems a little overkill.
Can anyone suggest a more elegant solution?