Welcome Guest, Not a member yet? Register   Sign In
Auto Load Form Validation Library based on existance of post array.
#1

[eluser]Henry Weismann[/eluser]
I was thinking of creating a hook right after the controller is called to load the form validation library and attach it to the controller if the POST array isset.

I was thinking this is the best way to reduce a line of code in each controller and also to not have to load it when it is not needed. The only downfall I can think of is that now im loading a hook on every page load instead but maybe loading a hook is less intensive then always auto loading the form validation.

Im thinking it would be like this...

Code:
function load_form_validation()
{
$CI = & get_instance();

if(isset($_POST))
{
$CI->load->library('form_validation');

}

}

Now Im not sure if that would make it accessible by the controller? Also does anyone see any reasons this is a bad idea?


Messages In This Thread
Auto Load Form Validation Library based on existance of post array. - by El Forum - 07-24-2009, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB