I'd like to have input validated with form_validation class, that'll allow me to put numeric or empty value in the field.
Something like this:
$this->form_validation->set_rules('field[]','The field','numeric or empty|xss_clean');
Is this possible to achieve?
$this->form_validation->set_rules('field[]', 'The field', 'numeric|xss_clean');
This should be sufficient in theory, since the field hasn't been set to required.
But, it returns me the errors
Then perhaps an extra step:
if (!empty($this->input->post('field[]')))
{
$this->form_validation->set_rules('field[]', 'The field', 'numeric|xss_clean');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With