[eluser]iainco[/eluser]
The error I get when my password fields don't match is:
Code:
The Confirm Password field does not match the password1 field.
but I've set the label correctly for password1, any ideas? Controller code below, view code is perfect - field names matching up and so on.
This also happens with the email1 and email2 fields...
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed.');
class Register extends Base_Controller
{
function index()
{
$this->display('register', array('title' => 'Register'));
}
function submit()
{
$this->form_validation->set_rules(array(
array(
'field' => 'title',
'label' => 'Title',
'rules' => 'required|trim|min_length[2]|max_length[4]'
),
array(
'field' => 'forenames',
'label' => 'Forename(s)',
'rules' => 'required|trim|max_length[30]'
),
array(
'field' => 'surname',
'label' => 'Surname',
'rules' => 'required|trim|max_length[30]'
),
array(
'field' => 'postcode',
'label' => 'Postcode',
'rules' => 'required|trim'
),
array(
'field' => 'day',
'label' => 'Date of Birth Day',
'rules' => 'required|trim|is_natural_no_zero|max_length[2]'
),
array(
'field' => 'month',
'label' => 'Date of Birth Month',
'rules' => 'required|trim|is_natural_no_zero|max_length[2]'
),
array(
'field' => 'year',
'label' => 'Date of Birth Year',
'rules' => 'required|trim|is_natural_no_zero|exact_length[4]'
),
array(
'field' => 'sex',
'label' => 'Sex',
'rules' => 'required|trim|is_natural|exact_length[1]'
),
array(
'field' => 'email1',
'label' => 'E-mail Address',
'rules' => 'required|trim|max_length[30]|valid_email'
),
array(
'field' => 'email2',
'label' => 'Confirm E-mail Address',
'rules' => 'required|matches[email1]|callback__emailCB'
),
array(
'field' => 'password1',
'label' => 'Password',
'rules' => 'required|trim|min_length[6]|max_length[12]'
),
array(
'field' => 'password2',
'label' => 'Confirm Password',
'rules' => 'required|matches[password1]'
))
);
if($this->form_validation->run())
{
$this->load->model('user/register_model');
$this->register_model->register();
redirect();
}
else
{
$this->load->helper('form');
show_error(validation_errors());
}
}
function _emailCB()
{
$this->load->model('user/register_model');
$this->form_validation->set_message('_emailCB', 'The e-mail address you entered is currently in use with another account.');
return $this->register_model->emailCB();
}
}
?>