CodeIgniter Forums
How validate this rules - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How validate this rules (/showthread.php?tid=89033)



How validate this rules - motoroller - 12-26-2023

I have form, if checkbox in my form (print) is checked (has value 'yes') i need validate email, if not dont validate

My rules like that

'print' => [
'label' => ' ',
'rules' => 'permit_empty|in_list[yes]',
],

'email' => [
'label' => ' ',
'rules' => 'required_with[print]|max_length[30]|valid_email'
]

When i valudate without print i got error from valid_email