/ Published in: PHP
run as callback from form_validation->setrules
ex:
$this->form_validation->set_rules('cc_number','Credit Card #','required|max_length[20]|callback_alpha_dash_space');
ex:
$this->form_validation->set_rules('cc_number','Credit Card #','required|max_length[20]|callback_alpha_dash_space');
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function alpha_dash_space($str) { { $this->form_validation->set_message('alpha_dash_space', 'The %s field may only contain numeric characters and dashes.'); return FALSE; } else { return TRUE; } }