CodeIgniter Forums
Validation Form - 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: Validation Form (/showthread.php?tid=84888)



Validation Form - motoroller - 11-19-2022

I post data via AJAX on the server i get it like

[

name => ''
sex=> ''

]

My validation

'name' => [
            'label' => ' ',
            'rules' => 'required'
        ],

       'sex' => [
'label' => ' ',
'rules' => 'in_list[male,female]',
],

But when i load $this->validator->getErrors();

On"sex" field i got error "this field must be in list", but "sex" field is not required, why is happening?
I need next actions when field is filled check in list, when field is empty dont check


RE: Validation Form - motoroller - 11-19-2022

permit_empty