• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.