Return to the previous screen after registering using Kohana

3

I have a screen where I get a parameter (id) and from it I mount a form. After saving this form I need to return to the previous screen to display what was saved. How can I do this? I have tried in many ways, several Requests but nothing works.

Form:

<form name="cad_user" id="cad_user" action="/user/novo" method="post">
            <div class="modal-body">

                <input type="hidden" id="txtCadUsrId" value="">                            
                <label for="txtEdtUsrNomTop">Nome</label>
                <input type="text" id="nome" name="nome" class="form-control">
                <label>Email</label>
                <input type="text" id="email" name="email" class="form-control">
                <label>Senha</label>
                <input type="password" id="pass" name="pass" class="form-control">
                <label>Repita a senha</label>
                <input type="password" id="pass2" name="pass2" class="form-control">
                <input type="hidden" name="codCliente" id="codCliente" value="<?php echo $clientes['cliente']->id ?>" />
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
                <button id="Cadastro"  type="submit" class="btn btn-primary">Cadastrar</button>
            </div>
        </form>

Action that registers in the bank:

public function action_novo(){
    $cliente = ORM::factory('cliente');        
    $cliente->nomeCliente = $this->request->post('nomeCliente');
    $cliente->cnpjCliente = $this->request->post('cnpjCliente');
    $cliente->dataCadastro = date("Y-m-d H:i:s");
    if($cliente->save()){
        $session = Session::instance();
        $session->set('msg', 'Cliente cadastrado com sucesso!');            
        $this->redirect('admin/listClient');            
    }

}
    
asked by anonymous 06.03.2014 / 23:16

1 answer

5

Problem solved.

I put this code in the action:

HTTP::redirect('admin/detailClient/'.$this->request->post('codCliente'));
    
06.03.2014 / 23:57