Welcome Guest, Not a member yet? Register   Sign In
Can not use localization on form validation rules
#1

We have a set of rules like below:

PHP Code:
public $rules = array(
 
'login'=>array(
 
'email' => array(
 
'field' => 'email',
 
'label' => 'Email',
 
'rules' => 'trim|valid_email|required'
 
), 

where we would like to replace the 'label' => 'Email' with $this->lang->line('user_email')

However it produces the following error:

Message: Constant expression contains invalid operations

Are we doing something wrong?
Reply
#2

You can't use variables inside class variables. You will need to assign $rules, from within your __construct().
Reply




Theme © iAndrew 2016 - Forum software by © MyBB