Tutorial :Using CodeIgniter built-in form validator class without an actual form submission



Question:

Is it possible to validate a set of data (an array) with the form validation class in CodeIdniter? i.e. when there his no form submitted.

If it's not possible, what other way could I validate this data using the set of validation rules written in form_validation config file?

Thanks in advance!


Solution:1

I think you can validate any data using form validation, I have never tried, but it should work if you assign to $_POST array values manually (without submitting form) and then try to validate it.


Solution:2

From the manual, under the section rule reference,

Note: These rules can also be called as discrete functions. For example:

$this->form_validation->required($string);  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »