[eluser]kdawson[/eluser]
Hi,
I am using the form validation like this
Code:
$this->form_validation->set_rules('home_phone', 'Home Phone', 'trim|max_length[20]|min_length[10]|alpha_dash');
Yet in that form field, if the user leaves it blank (not required) but also has a blank space in there, it triggers the "min_length[10]" error.
Shouldn't it be trimming first? I notice when it directs back to the form and using set_value() , the space is removed.
I thought maybe having the "trim|" first in the rules would help, but no.
Should the fact that it is not required and trimmed mean that:
- It is first trimmed (white space removed)
- Checked if it is required or not
- if it is not required and blank after trimming, it should pass the rule "trim|max_length[20]|min_length[10]|alpha_dash"
Am I doing something wrong?
Thanks
Regards,
Ken