Codeigniter form validation in config depends on another input - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Codeigniter form validation in config depends on another input (/showthread.php?tid=68020) |
Codeigniter form validation in config depends on another input - vahid.vdn - 05-11-2017 I'm using Codeigniter form validation by config (not setting rules manually). What I need, is setting required rule depending on the other field. For example, Imagine we have the following rules: Code: 'user' => array( foo input must be required based on email field. Note: It can be done with callback or anonymous function, but it makes it a bit difficult in big applications. Any idea? RE: Codeigniter form validation in config depends on another input - Martin7483 - 05-11-2017 Extend Form_validation with your own MY_Form_validation You can then place your own rule methods in this file and set the rule as you would set any other rule. |