CodeIgniter Forums
custom validation returns error always - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: custom validation returns error always (/showthread.php?tid=63832)



custom validation returns error always - sammyci - 12-13-2015

I have a custom validator that returns error always.

class myValidation extends CI_Form_validation {
/**
* myValidation::
*/

function fieldvalueisok($value){
//validates value against illegal entries such as "xxx"

$bannedValues=array('a','b','c');
if(in_array(strtolower($value),$bannedValues)){
return false;
}
return true;
}

}

Even if i return true everywhere, in a blank function etc, still i get an error from it. What am I missing? Please i wanna know more than the method above..the above is just an eg.


RE: custom validation returns error always - PaulD - 12-13-2015

What is the error you are getting - that would help...

Best wishes,

Paul.


RE: custom validation returns error always - sammyci - 12-14-2015

(12-13-2015, 01:56 PM)PaulD Wrote: What is the error you are getting - that would help...

Best wishes,

Paul.

Alo Paul...i get the error message set for in in my form validation language file. The form don't get submitted and validation_error() always always have an error message.


RE: custom validation returns error always - CroNiX - 12-14-2015

This is not the proper way to extend native libraries. Notice what they name theirs. I don't think your extended class is even being loaded since it's named improperly.

https://codeigniter.com/user_guide/general/creating_libraries.html#extending-native-libraries


RE: custom validation returns error always - InsiteFX - 12-15-2015

MY_Form_validation {

}