Problem with errors delimiters |
Hello all!
I have a problem with setting delimiters via config file. According to the documentation (http://www.codeigniter.com/user_guide/li....html#id23), I created form_validation.php at /application/config/ folder. Then I added there two lines: PHP Code: $config['error_prefix'] = "<div class=\"error\">"; When I use PHP Code: $this->form_validation->set_error_delimiters("<div class=\"error\">", "</div>"); What's wrong am I doing? Thank you in advance!
Did you try it with single quotes around the div tags? That's how it's described in the documentation:
Code: $config['error_prefix'] = '<div class="error">';
04-29-2015, 11:07 AM
(This post was last modified: 04-29-2015, 11:08 AM by mwhitney. Edit Reason: removed stray URL code )
Single vs. double quotes should not make a difference. The documentation uses single quotes because it matches the Style Guide.
However, I'm not sure why loading them from the config file wouldn't work unless there was something wrong with the config file or the error delimiters were being set somewhere else, after the library is loaded.
Allow me a stupid question... did you add them inside the php tags?
<?php $config... ... ?> Website: http://avenir.ro
@Cobblestone
Apparently not. I have spent the last couple of hours on this and feel like I am getting stupider by the minute.
10-16-2015, 01:15 AM
(This post was last modified: 10-16-2015, 01:23 AM by PaulD. Edit Reason: Added note about autoloading libraries )
Hi,
I made a test file and it all seems to be working perfectly. Controller: Test.php Code: <?php View: test_view.php Code: <html> Config file: form_validation.php Code: <?php Both the automatic running of the form validation rules and the error delimiters are both working fine. Try using these three files and see if it is working for you too. I hope that helps, Paul. Edit: Just to mention that I am autoloading the required libraries in my application config files for this example, such as url helper and form_validation.
Same issue here. Config doesn't work for me. It's autoloaded, but all error messages, for single message or for a whole form, isn't using prefix and suffix.
In your config array have you set them separately?
e.g PHP Code: $config = array( I have not experienced any problems with using this at all. Hope that helps, Paul. |
Welcome Guest, Not a member yet? Register Sign In |