custom validation function placement

[eluser]Jayson Ng[/eluser]
when creating your own function to check for form validation, does it need to be placed IN the same controller?

because I tried putting my custom function in its own plugin (so I could easily re-use it in other projects) but that didn't work.

any help would be appreciated.


Try putting it inside a library
This way you can autoload it and use it at anytime.


The callback function does need to be in the same controller as the form validation. However, that function can pull whatever it needs to do the job. So create your plugin, then create your callback function inside the controller, and call your plugin from the callback function.

[eluser]Jayson Ng[/eluser]
@aken: thanks! sounds like this is the way to go. Smile

Did you consider extending the form_validation library?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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