I am using modular MVC with codeigniter. I have a module playlist in which I have a admin controller and I am having a private $rules variable for setting the form validation rules.
I have both create and edit functions in the same file and validating both the forms (add,edit which are also created dynamically from only one file form.php).
$this->load->library('form_validation');
$this->form_validation->set_rules($this->rules);
$this->form_validation->set_error_delimiters(' <p class="error">', '</p>');
These are used in both create and edit functions. some of the fields i dont want to validate in edit mode. Should I need to create different private rules for both of them or is there any better way to handle this in codeigniter since I am new to it. I want to remove validation for FILE tag as user dont need to upload at edit mode.
Thanks
Here is an answer from the CI forums (original link).
You can define the rules for create/edit using some form of heirachy, then;
Or, you could do this;
Below is the code for the extended Form_validation class, saved in the application libraries folder as MY_Form_validation.php