![]() |
Dinamic rule validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Dinamic rule validation (/showthread.php?tid=83436) |
Dinamic rule validation - pippuccio76 - 09-26-2022 hi ,sorry for english ,i have several couple of file everyone size_1 quantity_1 size_2 quantity_2 ecc the field become to a db's table . how can i set roule dinamicalii , now my roules are [CODE] $rules= [ 'idSize_1'=>[ 'rules'=>'check_size_quantity[idSize1,idQuantity1]', 'errors'=> 'check_size_quantity'=>'You must enter both size and quantity of field XXXX ' ] ], ]; [/CODE ] how can i do this dinamically ? how can i set xxx as field name ? RE: Dinamic rule validation - pippuccio76 - 09-27-2022 this is my $_POST Code: Array ( [id_sessioni_ordini] => 3 [nomeCapoAbbigliamento_1] => T-shirt [idCapoAbbigliamento_1] => [taglia_1] => 2 [quantita_1] => 3 [nomeCapoAbbigliamento_2] => Felpa [idCapoAbbigliamento_2] => [taglia_2] => [quantita_2] => [nomeCapoAbbigliamento_3] => Pile [idCapoAbbigliamento_3] => [taglia_3] => 3 [quantita_3] => 2 [nomeCapoAbbigliamento_4] => Pantalone lungo [idCapoAbbigliamento_4] => [taglia_4] => [quantita_4] => ) Code: $post = $this->request->getPost(); Code: /** |