Welcome Guest, Not a member yet? Register   Sign In
CI can't access error message.
#1

[eluser]doktorcivanim[/eluser]
Hi,

I am working on a form and have two problems.

My first is, I have a custom validation function, it is correctly called, but I cannot get the parameter. I only get the name of the parameter I give (['username'] gives the value 'username').

To ressolve this, I used the $this->input->postfunction to get the parameter.

The second problem is that when giving an error (set_message) I get "Unable to access an error message corresponding to your field name." What is wrong?


My function and declaration of rules:
Code:
//Rules
$this->form_validation->set_rules('begin_date', 'Begindate', 'callback_checkBeginDate[end_date]');
$this->form_validation->set_rules('begin_date', 'Enddate');


//Custom rule
function checkBeginDate($beginDate,$endDate){
...
$this->form_validation->set_message('begin_date', 'Enddate must be bigger or equal to begindate');
...

...

Thanks.
#2

[eluser]Xollef[/eluser]
You should probably use rule name instead of field when assigning error messages.

Try something like:
Code:
$this->form_validation->set_message('checkBeginDate', 'Enddate must be bigger or equal to begindate');




Theme © iAndrew 2016 - Forum software by © MyBB