Welcome Guest, Not a member yet? Register   Sign In
Validation Config
#1

[eluser]OES[/eluser]
Hi Peeps

Hope you can help with this.

I was hoping to create a Validation config to set the error delimiters.

I created a Validation.php file in config and have tried many different ways to set the delimiters.

2 examples.

Code:
$config['_error_prefix'] = '<li>';
$config['_error_suffix'] = '</li>';

And

$config['error_prefix'] = '<li>';
$config['error_suffix'] = '</li>';

But none gets picked up.

Hope you can advice what Im doing wrong or infact this can be done for Validation.

Thank in Advance.
#2

[eluser]SitesByJoe[/eluser]
You do realize that this is setting the delimiters is covered in the User Guide?
#3

[eluser]OES[/eluser]
Yes.

But you have to enter them into the controler.

Code:
$this->validation->set_error_delimiters('<div class="error">', '</div>');

I want it as a global config so I dont have to keep setting across my models.

And I dont want to touch the core files for updates etc.

Does that make sense !!
#4

[eluser]Référencement Google[/eluser]
That make a lot of sense and I encounter the same problem, I would find very logic that we can set that in a config file.

I didn't tried it, but as the new 1.7 version on SVN has a complete new form validation library that allow to set rules in a config file, that maybe worth to try it. I am interested to know if it worked so post your result here.
#5

[eluser]Unknown[/eluser]
Maybe a bit late, but I've figured somewhat of a workaround for this problem. I created an extension of the Form_validation class in the file application/libraries/MY_Form_validation.php, as follows:

Code:
&lt;?php
  Class MY_Form_validation extends CI_Form_validation
  {
    function MY_Form_validation($rules = array())
    {
      parent::CI_Form_validation($rules);
      
      $this->set_error_delimiters('<div class="error">', '</div>');
      
    }
  }
?&gt;

I couldn't figure out how to save the config in a file....




Theme © iAndrew 2016 - Forum software by © MyBB