1
I would like help on how to get a value of one hidden
that is in a useful. I need that value to send to the next screen, but since it’s on a multi-line table, I’m not getting it done.
I need to get this value in javascript.
The screen:
<div class="grupoLista">
<util:tabela id="lista" colecao="${form.listaPrograma12}" paginar="true" indiceProperty="lerDe" totalRegistrosProperty="qtdTotalLista" tamanhoPagina="30" idxLinha="true">
<util:coluna id="id" titulo="" propriedade="nuContrato" tipo="radio">
<input type="radio" name="listaIndice" value="${idxLinha}" />
<input type="hidden" name="listanuContrato" value="${lista.nuContrato}" />
<input type="hidden" name="listanuStatus" value="${lista.nuStatus}" />
<input type="hidden" name="listanoStatus" value="${lista.noStatus}"/>
<input type="hidden" name="listanoEmpresa" value="${lista.noEmpresa}"/>
<input type="hidden" name="listanoGestor" value="${lista.noGestor}"/>
<input type="hidden" name="listadtAssina" value="${lista.dtAssina}"/>
<input type="hidden" name="listavlContrato" value="${lista.vlContrato}"/>
<input type="hidden" name="listavlDevolucao" value="${lista.vlDevolucao}"/>
<input type="hidden" name="listavlDev" value="${lista.vlDev}"/>
<input type="hidden" name="listanuEstagio" value="${lista.nuEstagio}"/>
<input type="hidden" name="listanoEstagioCont" value="${lista.noEstagio}"/>
</util:coluna>
</div>
The js
function listar(){
var validado = true;
if(!checkRadio()){
mensagemAlerta("Selecione uma das opções na lista.", "INF");
validado = false;
}
if(validado){
var linSel = $("input[name=listaIndice]:checked").val();
document.getElementById("nuContrato").value = $("#listanuContrato" + linSel).val();
document.getElementById("nuStatus").value = $("#listanuStatus" + linSel).val();
var idEstagio = $("input[name=listanuEstagio]" + linSel).val();
document.getElementById("selEstagioCont").value = idEstagio;
var noEstagio = $("input[name=listanoEstagioCont]").val();
document.getElementById("noSelEstagioCont").value = noEstagio;
submitForm("listarContratoDevolucao");
}
}
In short: In jsp a list is mounted, a table with several rows and columns as well. I select a line through a radio and press the button to send what I have selected. I need to take the Field Liststagio of what was selected and play in another Hidden, so when you press the send button, this value remains for the next screen. The situation is: how to capture this listStationio since it is part of a mounted list, with the code I made it is only returning the value of the first line.
*in time: I am only doing code maintenance.
Follows HTML code:
<html><head></head><body><div id="modalPane" style="visibility: hidden;"></div><div id="container"><div id="header"></div><div id="corpo"><div class="confidencialidade"></div>
<!-- corpo -->
<div id="funcao"></div><div class="divisor"></div><div style="float:left;float:right;"></div>
<form id="form" action="/projet/programa.do" method="post" name="ContratoForm">
<input id="breadCrumb" type="hidden" value="/projeto/programa.do?.....?mt=pesquisar;" name="breadCrumb">
</input><input id="backPage" type="hidden" value="/projeto/programa.do?mt=ini" name="backPage"></input>
<input id="mt" type="hidden" value="pesquisar" name="mt">
</input><input id="nuContrato" type="hidden" value="9999999" name="nuContrato"></input><input id="chkFiltroNumCont" type="hidden" value="" name="chkFiltroNumContr"></input>
<input id="tela" type="hidden" value="lista" name="tela"></input><div id="conteudo"><div class="informacao">
CNPJ:
<b></b></div><div class="informacao">
Nome Contratante:
<b></b></div><div class="grupoLista"><script type="text/javascript"></script><input id="qtdTotalLista" type="hidden" value="31" name="qtdTotalLista"></input><div id="divIE" class="divlinhaTabela"><table id="tblIE" class="dados" width="100%">
<tbody>
<tr class="azul">
<th></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap"></th><th nowrap="nowrap" style="text-align:right"></th><th nowrap="nowrap" style="text-align:right"></th><th nowrap="nowrap" style="text-align:right"></th></tr>
<tr class="branco">
<td><input type="radio" value="0" name="listaIndice"></input>
<input type="hidden" value="9999999" name="listanuOperacao"></input>
<input type="hidden" value="4" name="listanuSituacao"></input>
<input type="hidden" value="Contratada/Notificado" name="listanoSituacao"></input>
<input type="hidden" value="Contrantante" name="listanoContratado"></input>
<input type="hidden" value="Gestor" name="listanoGestor"></input>
<input type="hidden" value="19/02/2016" name="listadtAssina"></input>
<input type="hidden" value="0000000000010000.00" name="listaValor></input>
<input type="hidden" value="0000000000000000.00" name="listavlDev"></input>
<input type="hidden" value="0000000000000000.00" name="listavlCredito"></input>
<input type="hidden" value="4" name="listanuEstagio'0'"></input>
<input type="hidden" value="Notificado de TCE" name="listanoEstagioOper"></input></td>
<td nowrap="nowrap"></td>
<td nowrap="nowrap"></td>
<td nowrap="nowrap">
9999999 - 99
</td><td nowrap="nowrap">
Contratada/Notificado
</td><td nowrap="nowrap"></td>
<td nowrap="nowrap"></td>
<td nowrap="nowrap">
Contratante
</td><td nowrap="nowrap"></td>
<td nowrap="nowrap"></td>
<td nowrap="nowrap" style="text-align:right"></td>
<td nowrap="nowrap" style="text-align:right"></td>
<td nowrap="nowrap" style="text-align:right"></td>
</tbody>
</table>
</div><div class="paginacao"><div class="numeros"></div>
<div style="float:left;"></div></div>
<span class="total"></span>
<div class="grupoBotaoLista"><div class="divisor"></div>
<img class="botao" onclick="listar();" src="resources/_images/botoes/bt_listar.gif" alt=""></img>
<img class="botao" onclick="volta();" src="resources/_images/botoes/bt_voltar.gif" alt=""></img></div></div></div>
</form>
<!-- mensagem -->
</div><div id="rodape"></div></div><form id="idsp" method="post" action="#"></form></body></html>
These inputs and radio are inside the same <TD> cell or in the same <TH> row>?
– Sam
They’re on the same line, I didn’t post all the code, but this radio stays in one column and ss repeats in several lines.
– Priscila.pcs
I have tried: Document.getElementById(""). value = $("#listingEstagio" + linSel). val(); but it does not feed selEstagioCont, and when asked to display gives unidefined
– Priscila.pcs
Try to get the value from this:
var idEstagio = $("input[value="+linSel+"]").closest("td").find("input[name=listanuEstagio]").val();
... if it doesn’t work, change the"td"
for"th"
or"tr"
.– Sam
I’ll try okay. Thank you
– Priscila.pcs
made the change, but when executing on the page, appeared the message: [13:08:05.499] Typeerror: $(...). Closest is not a Function
– Priscila.pcs
Your code has many errors, for example, this value without closing the quotes:
name="listaValor
and that value here:name="listanuEstagio'0'"
... that'0'
inside thename
that is correct?– Sam
This was an attempt to concatenate a value for me to recognize the number of the stage (unsuccessful attempt). The original code looked like this : <input type="Hidden" value="4" name="listanuEstagio"></input>
– Priscila.pcs