Displaying errors |
[eluser]ElliotReevey[/eluser]
I have been working on my first CodeIgniter project and have been overcoming several issues as I have progressed however I have hit another which I have been unable to find a decent solution to. I have some code, as shown below: Code: $this->form_validation->set_error_delimiters('<li>', '</li>'); The above code works fine and you will see my comment about where I would like to create a error message to pass back to the view if the condition is not met. I could easily pass this back to the view and display it on the screen however I already have Code: <?=validation_errors()?> Therefore my question is, is there anyway to add to the validation_errors() function and pass through my error message even though its not strictly a validation error from the form or will I have to create another function to deal with errors outside of the form validation? Cheers
[eluser]SPeed_FANat1c[/eluser]
I think you have to create another function, because validation_errors() will only show when $this->form_validation->run() is FALSE, but in your code it is TRUE, so it will not show anything. If you could check for errors before checking Code: if ($this->form_validation->run() == true) then you could make your own validation rule (read about callback functions http://ellislab.com/codeigniter/user-gui...#callbacks). |
Welcome Guest, Not a member yet? Register Sign In |