Problems extending the Form_validation (CI 1.7) |
[eluser]Nonox[/eluser]
Hi. I have some problems extending the new Form_validation, I followed the same process that I did with CI 1.6.3, below is the code example: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); How you can see is simple, but nothing happen, someone knows if I'm doing something wrong?
[eluser]OES[/eluser]
Hello All looks good to me but I did have a problem extending due to me using a config file to hold my form arrays. See my post here. http://ellislab.com/forums/viewthread/97063/ Also if you are looking to use the constructor you will need to do this. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Hope this helps.
[eluser]xwero[/eluser]
OES the $CI variable is defined in the parent class so you don't have to add it to the extended class.
[eluser]Nonox[/eluser]
Hi, first of all thanks for your advice. I tried with this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); But nothing happened, the core validations works fine, but my extension doesn't exist for CI.
[eluser]Nonox[/eluser]
Well, I have an entry in my array language like this: Code: $lang['test'] = "%s ?."; And... in my controller: Code: $this->form_validation->set_rules('fecha_nac', 'lang:adm_form_usuarios_modificar_campFecha', 'trim|required|exact_length[10]|xss_clean|test'); And... in my view: Code: <input name="fecha_nac" value="<?php echo set_value('fecha_nac',$fecha_nac);?>" class="input-text" type="text" maxlength=10> These validations works fine: Code: trim|required|exact_length[10]|xss_clean
[eluser]xwero[/eluser]
And what was the value you tested it with? Also try testing it with less rules, the other rules only add more things to be aware of while testing. Additionally you should check if the test in the language key is the value you added to the file. maybe you have the test key in another language file? You can remove the $this->CI lines they have no function in you case.
[eluser]Nonox[/eluser]
I found the mistake, I had written in a bad way the name of the file. Bad... MY_form_validation.php Good... MY_Form_validation.php Conclusion: This is the way: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And don't forget to write the name of the file respecting the capital letters. OES and xwero. Thank you very much!! |
Welcome Guest, Not a member yet? Register Sign In |