passing variable into anonymous function - form validation |
Hello, i would ask simple question.
is there any possibility to pass own parameter into anonymous function in set_rules for form_validation like its shown in first example below or its just possible to pass it trought callback function ? Thank you Code: $this->load->model('admin/currency_symbols_model', 'currency_symbols');
Not possible in the way you want it to, but not necessary either:
Code: $currency_id = 1; // your custom parameter EDIT: But actually, your code wouldn't work anyway as $this inside the anonymous function refers to the function itself, not to your controller, so you actually MUST use the use keyword to pass your currency_symbols object ... updated the code above.
ok in that case it isnt readable very well and not usefull so much (strange way to do that) .. i will use rather callback function .. there i can pass any variable and inside callback function $this refers to controllers class ... thanks for answer
|
Welcome Guest, Not a member yet? Register Sign In |