When using Codeigniter form validation, does alpha allow spaces? Ex. "Bob Smith"
Setting Validation Rules CodeIgniter lets you set as many validation rules as you need for a given field, cascading them in order, and it even lets you prep and pre-process the field data at the same time. To set validation rules you will use the set_rules() method: $this->form_validation->set_rules();
Validation Rule Reference. Given below are the most commonly used list of native rules available to use. Returns FALSE if the form element is empty. Returns FALSE if the form element does not match the one in the parameter.
PHP_EOL; $data['err'] = $err; $this->load->view('viewname', $data); } else if ($this->form_validation->run() == true ) { #code... } else.. after setting your custom message to $err variable, print it on your view. Save this answer.
One line solution:
$this->form_validation->set_rules('field', 'Field', 'regex_match[/^([a-z ])+$/i]');
Alpha characters and space.
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