Well, I have a view with two form and both have action="current_url()"
, that is, the two will execute the action on the same page, the problem is that regardless of the button I click to send the form it always executes the two generating the same error messages as if it recognizes only one form, wanted to know if you have any way to use two distinct forms and run them on the same page / method
<?php
if (validation_errors() != '') {
$mostra_box_msg = 'show';
}
?>
<script type="text/javascript">
$(document).ready(function() {
$("#box-msg").<?php echo $mostra_box_msg ?>();
$("#abre_resposta").click(function(){
$("#box-msg").toggle("slow")
});
});
</script>
<h3>Pergunta:</h3>
<?php
echo "<p>".anchor("area_tecnico", "<i class='icon-circle-arrow-left'></i> Voltar", array("class"=>"btn btn-small"))."</p>";
if ($this->session->flashdata('msgok') != "") echo '<p class="text-success">'.$this->session->flashdata('msgok').'</p>';
?>
<blockquote>
<p>Dados Gerais</p>
</blockquote>
<?php
$seguimento = $this->uri->segment(3);
$dados = $this->db->query("SELECT
i_chamada
, titulo
, DATE_FORMAT(dt_abertura, '%d/%m/%Y %H:%i') AS data_abertura
, DATE_FORMAT(dt_prevista, '%d/%m/%Y %H:%i') AS data_prevista
, DATE_FORMAT(dt_encerramento, '%d/%m/%Y %H:%i') AS data_encerramento
, status
, (SELECT nome FROM tecnicos AS z WHERE z.i_tecnico=a.i_tecnico) AS nome_tecnico
, (SELECT nome FROM areas AS z WHERE z.i_area=a.i_area) AS nome_area
FROM chamados AS a
WHERE i_chamada = $seguimento")->result_array();
if ($dados[0]['status'] == 'N') {
$status = 'Novo';
$type = 'info';
} elseif ($dados[0]['status'] == 'E') {
$status = 'Em Andamento';
$type = '';
} elseif ($dados[0]['status'] == 'R') {
$status = 'Resolvido';
$type = 'success';
} elseif ($dados[0]['status'] == 'C') {
$status = 'Cancelado';
$type = 'error';
} else {
$status = 'Aguardando Usuário';
$type = 'warning';
}
?>
<table class="table">
<thead>
<tr>
<th width="25%" class="text-center">Número de Identificação</th>
<th width="25%" class="text-center">Técnico</th>
<th width="25%" class="text-center">Status</th>
<th width="25%" class="text-center">Área</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><?php echo $dados[0]['i_chamada'] ?></td>
<td class="text-center"><?php echo ($dados[0]['nome_tecnico'] == NULL ? '<span class="muted">Aguardando Resposta</span>' : $dados[0]['nome_tecnico']) ?></td>
<td class="text-center"><span class="label label-<?php echo ($type == 'error') ? 'important' : $type ?>"><?php echo $status ?></span></td>
<td class="text-center"><?php echo $dados[0]['nome_area'] ?></td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr>
<th width="25%" class="text-center">Assunto</th>
<th width="25%" class="text-center">Data Abertura</th>
<th width="25%" class="text-center">Data Prevista</th>
<th width="25%" class="text-center">Data Encerramento</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center"><?php echo $dados[0]['titulo'] ?></td>
<td class="text-center"><?php echo $dados[0]['data_abertura'] ?></td>
<td class="text-center"><?php echo ($dados[0]['data_prevista'] == NULL) ? '<a href="#ModalData" data-toggle="modal"><i class="icon-edit"></i></a>' : $dados[0]['data_prevista'] ?> </td>
<td class="text-center"><?php echo ($dados[0]['data_encerramento'] == NULL) ? '<a href="#ModalData" data-toggle="modal"><i class="icon-edit"></i></a>' : $dados[0]['data_encerramento'] ?></td>
</tr>
</tbody>
</table>
<br>
<br>
<blockquote>
<p>Mensagens</p>
</blockquote>
<table class="table table-bordered">
<thead>
<tr>
<th width="15%" class="text-center">Enviado Por</th>
<th width="50%" class="text-center">Mensagem</th>
<th width="10%" class="text-center">Data e Hora</th>
<th width="5%" class="text-center">Código</th>
</tr>
</thead>
<tbody>
<?php
$interacoes = $this->db->query("SELECT
i_interacao
, DATE_FORMAT(dt_interacao, '%d/%m/%Y %H:%i') AS data_interacao
, descricao
, i_tecnico
, status
, (SELECT nome FROM tecnicos AS z WHERE z.i_tecnico=a.i_tecnico) AS nome_tecnico
, (SELECT nome FROM clientes AS z WHERE z.i_cliente=a.i_cliente) AS nome_cliente
FROM interacoes AS a
WHERE i_chamada = $seguimento")->result_array();
foreach ($interacoes as $key) :
if ($key['status'] == 'N') {
//$status = 'Novo';
$type = 'info';
} elseif ($key['status'] == 'E') {
//$status = 'Em Andamento';
$type = '';
} elseif ($key['status'] == 'R') {
//$status = 'Resolvido';
$type = 'success';
} elseif ($key['status'] == 'C') {
//$status = 'Cancelado';
$type = 'error';
} else {
//$status = 'Aguardando Usuário';
$type = 'warning';
}
if ($key['i_tecnico'] == NULL) {
echo '
<tr>
<td class="text-center">'.$key['nome_cliente'].'</td>
<td class="text-center">'.$key['descricao'].'</td>
<td class="text-center">'.$key['data_interacao'].'</td>
<td class="text-center">#'.$key['i_interacao'].'</td>
</tr>
';
} else {
echo '
<tr class="'.$type.'">
<td class="text-center"><b>'.$key['nome_tecnico'].'</b></td>
<td class="text-center">'.$key['descricao'].'</td>
<td class="text-center">'.$key['data_interacao'].'</td>
<td class="text-center">#'.$key['i_interacao'].'</td>
</tr>
';
}
endforeach;
?>
</tbody>
</table>
<div style="clear: both; margin-bottom: 5px"></div>
<a id="abre_resposta" class="pull-right btn btn-mini btn btn-info"><i class="icon-plus icon-white"></i> Nova Resposta</a>
<br>
<br>
<div style="width:62%; margin:0 auto" id="box-msg">
<?php echo form_open(current_url(), 'class="form-horizontal"'); ?>
<div class="control-group">
<div class="controls">
<?php
echo form_error('descricao', '<p class="text-error">', '</p>');
?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Status</label>
<div class="controls">
<select name="status">
<option value="" selected="selected" disabled="disabled">Selecione um Status</option>
<option value="N">Novo</option>
<option value="E">Em Andamento</option>
<option value="R">Resolvido</option>
<option value="C">Cancelado</option>
<option value="P">Pendente</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Mensagem</label>
<div class="controls">
<?php echo form_textarea(array('name'=>'descricao', 'value'=>set_value('descricao'), 'class'=>'input-xxlarge', 'rows'=>'2')); ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Observação</label>
<div class="controls">
<?php echo form_textarea(array('name'=>'tecnico', 'value'=>set_value('tecnico'), 'class'=>'input-xxlarge', 'rows'=>'2')); ?>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary">Enviar Resposta</button>
</div>
</div>
<?php echo form_close(); ?>
</div>
<!-- Modal -->
<?php
$hidden = array(
'seguimento_hidden' => $this->uri->segment(3)
);
?>
<div id="ModalData" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Alteração de Datas</h3>
</div>
<div class="modal-body">
<?php
echo form_open(current_url(), 'class="form-horizontal"', $hidden);
?>
<div class="control-group">
<label class="control-label" for="inputEmail">Data e Hora Prevista</label>
<div class="controls">
<?php echo form_input(array('name'=>'dt_prevista', 'value'=>set_value('dt_prevista'), 'class'=>'date-time-mask')); ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Data e Hora Encerrada</label>
<div class="controls">
<?php echo form_input(array('name'=>'dt_encerramento', 'value'=>set_value('dt_encerramento'), 'class'=>'date-time-mask')); ?>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary">Salvar Dados</button>
</div>
<?php echo form_close(); ?>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#ModalData').modal('show')
});
</script>
The second form is inside a bootstrap modal where I will only use to update two bank dates