User defined error message do not work |
[eluser]Zombie1[/eluser]
I'm having some trouble designing my user defined error messages. My 'required' error messages work fine. Code: $this->form_validation->set_rules('callback_show_error_message', 'username', 'Username'); As you can see the two fields that use 'required' work fine whenever a user leaves a textfield blank an error is displayed. It's just my own error message that doesn't display. Here's the function: Code: function show_error_message() If anyone has any ideas then please let me know.
[eluser]Tim Brownlaw[/eluser]
I have an idea... Go and read Form Validation and read the section on callbacks. That will answer your question.
[eluser]Zombie1[/eluser]
Thanks but I've already read it and copied it but it still doesn't work.
[eluser]treenef[/eluser]
You need to display the validation errors... <?php echo validation_errors(); ?>
[eluser]rm_beginner[/eluser]
Code: $this->form_validation->set_rules('callback_show_error_message', 'username', 'Username'); try to put your callback right side. Code: $this->form_validation->set_rules( 'username', 'Username', 'callback_show_error_message'); hope it works.
[eluser]Tim Brownlaw[/eluser]
[quote author="rm_beginner" date="1403694854"] Code: $this->form_validation->set_rules('callback_show_error_message', 'username', 'Username'); try to put your callback right side. Code: $this->form_validation->set_rules( 'username', 'Username', 'callback_show_error_message'); hope it works.[/quote] That's how it's written in the user guide! @zombie1.... I'd seriously be reading it again and checking it against what you have written. |
Welcome Guest, Not a member yet? Register Sign In |