You may be using ajax to populate the fields, maybe this will help you:
<script>
function pupularModal(id)
{
var cod_item = id;
$.ajax({
url: "/lista/popular_modal",
type: "POST",
data: {cod_item: cod_item},
dataType: "html",
success: function (result) {
$("#form_list input").empty(); //limpa os inputs do formulário
var data = jQuery.parseJSON(result);
if (data.status == true) {
$("#idInput").val(data.value1);
$("#idInput2").val(data.value2);
$("#modalId").modal('show');//mostra modal com as informações preenchidas
} else {
alert('Erro ao processar')
}
}
});
}
</script>
Controller:
public function popular_modal()
{
$cod_lista = $this->input->post('cod_item');
$item = $this->list_model->get_by($cod_lista);
if ($item) {
$data = array(
'status' => true,
'value1' => $item->value1,
'value2' => $item->value2
);
echo json_encode($data);
}
}
And on the button you use a onclick="pupularModal(IdDoItem);"
What have you done to it? When you click on the link, you pass the id, take the data and return to the modal? I usually do this with ajax.
– Marcelo Diniz