Question

I want to do Existing Email Check with Validation Engine.But there is a problem showing in firebug console like below:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: reg_em

Filename: controllers/user.php

Line Number: 170

["email",true]

Ajax error: 200 parsererror

Here is my jquery.validationEngine-en.js:

"ajaxCheckEmail": {
                "url": base_url+"user/checkEmailExistence/",
                "extraDataDynamic": ['#reg_em'],
                "alertTextOk": "* This email is available",
                "alertText": "* This email is already taken",
                "alertTextLoad": "* Validating, please wait"
            },

view of Email Field:

<input type="text" class="text_item_val_style validate[required,ajax[ajaxCheckEmail],custom[email]]" name="useremail" id="reg_em" style="height:21px;"/>

Controller:

function checkEmailExistence(){

   $email        = $_REQUEST['reg_em'];
   $getStatus = $this->users->existing_email_check($email);
   echo $getStatus;

}

Model:

function existing_email_check($email){
    $valid  = true;
    $rs     = $this->db->where('email', $email)->get('users');
    if($rs->num_rows() > 0){
        $valid  = false;
    }
    $rs->free_result();
    $arr    = array('email',$valid);
    return json_encode($arr);
}
Was it helpful?

Solution

Instead of this $email = $_REQUEST['reg_em']; write $email = $_REQUEST['useremail'];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top