Welcome Guest, Not a member yet? Register   Sign In
load a function in a different controller whrn validation is false
#1

[eluser]max123[/eluser]
i want to load a function inside a different controller when validation is false. It means the form loaded by a different controller and it is submitted in to a different controller. Controllers cannot load as methods or views.

eg: $this->load->controller('con1')

Please help me
#2

[eluser]Jan_1[/eluser]
Why do you want to do so?
Is there some functionality directly in the controller and not in models?
So if there is some try to bring it in models. So you are able toload them from every controller.
#3

[eluser]max123[/eluser]
when doing validations, if validation FALSE we have to load the controller again bcoze we cannot load the veiw directly. In that case how can I do that
#4

[eluser]Jan_1[/eluser]
Not looking for this? validation class (!=/== FALSE)
Code:
function index()
{
    $this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
        
    if ($this->form_validation->run() == FALSE)
    {
        $this->load->view('myform');
    }
    else
    {
        $this->load->view('formsuccess');
    }
    }
}
#5

[eluser]max123[/eluser]
in the form set_value should be used as text box values. Also I want to display values taken from the data base in those text boxes. So how can I do both the things. That means keep the text box values when the validation is false and display the values taken from the database in same text boxes id data is available in the database
#6

[eluser]wiredesignz[/eluser]
You can try using Modular Extensions - PHP5 which allows you to load a controller using the HMVC design pattern.
Code:
$this->load->module('controller_name');
See my signature.




Theme © iAndrew 2016 - Forum software by © MyBB