Welcome Guest, Not a member yet? Register   Sign In
Username And Email Login Form Validation Question

(This post was last modified: 04-12-2017, 11:36 PM by neuron.)

I think u need custom validation method:

1. in application/libraries create file MY_Form_validation.php

and define your custom method there
PHP Code:

class MY_Form_validation extends CI_Form_validation {

   function __construct($config = array()) {
       $this->set_error_delimiters'<div class="has-error">''</div>' );
public function 
//validation codes here
//if valid 
return true;
return false;


2. library validation is in the exactly same way:  $this->load->library('form_validation'); it will load your form_validation extension automaticly

3. and $this->form_validation->set_rules('type', 'Username Or Email', 'trim|required|[font=Monaco, Consolas, Courier, monospace]is_valid_email_or_username'); [/font]
4. for validation error message u can set custom error message for your custom validation rule. in application/language/your_lang/form_validation_lang.php
add $lang['is_valid_email_or_username'] = "Error messafe {field}";

5. I am not sure but as u inherited system form_validation library you should be able to use $this->valid_email($user_input) in your custom validatio method

Messages In This Thread
RE: Username And Email Login Form Validation Question - by neuron - 04-12-2017, 10:58 PM

Theme © iAndrew 2016 - Forum software by © MyBB