Welcome Guest, Not a member yet? Register   Sign In
Problem with Form Validation - Validation Rules in Config File
#1

[eluser]Unknown[/eluser]
Hi,

as described in the Manual (http://ellislab.com/codeigniter/user-gui...ngtoconfig) i stored my Validation Rules in the Config File /config/form_validation.php and it works pretty fine.

Now i would like to add some Conditions to those Rules: i.e. if the User is logged in use Rule A else use Rule B.

I tried it this way:
Code:
if ( $this->session->userdata['id'] ) { /*rule a*/ } else { /*rule b*/ }

but unfortunately this doesn't work; because obviously $this is unknown in that file, i get those notices/errors:
Code:
Undefined property: CI_Config::$session
Trying to get property of non-object
Undefined property: CI_Loader::$session
Trying to get property of non-object

is there a way i can solve this?




Theme © iAndrew 2016 - Forum software by © MyBB