Welcome Guest, Not a member yet? Register   Sign In
Moving form validation callbacks to a library
#3

[eluser]CroNiX[/eluser]
Sure you can and you were doing it right except for your rules declaration. Once you extend the form_validation library with MY_Form_validation it becomes part of the original class, so you don't need to reference it with "callback_". Its now just a regular rule like the other native rules, so just call it "username_check" in your rules $config array instead of callback_username_check.

"callback_" is kind of a magic word reference which forces CI to look for a function/method with the same name within the controller it was called from.


Messages In This Thread
Moving form validation callbacks to a library - by El Forum - 05-20-2011, 11:43 AM
Moving form validation callbacks to a library - by El Forum - 05-20-2011, 12:49 PM
Moving form validation callbacks to a library - by El Forum - 05-20-2011, 03:20 PM
Moving form validation callbacks to a library - by El Forum - 05-20-2011, 03:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB