0
Is it possible for the line color to change after the user selects a radio from the list taking into account that I am doing the page Ubmit ? the problem is that I am not able to do because as you can see below my Table pulls the database data dynamically
listarAgenda
this and Table
<table width="199" border="1" class="table table-condensed" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<thead class="style4">
<tr bgcolor="${cortop}" >
<th width="21" align="left" > </th>
<th width="178" align="left" ><strong>EXAMES / PROCEDIMENTOS</strong></th>
</tr>
<c:forEach var="item" items="${listarAgenda}">
<tr bgcolor="#F4F4F4">
<th align="left" nowrap="nowrap"><input type="radio" name="radio4" id="radio4" value="radio4" onclick="JavaScript:selecionarAgenda(${item.idAgenda},'${item.agenda}',${item.idLocalAtend},'${item.local}', 0, '');" /></th>
<th align="left" nowrap="nowrap"><a href="#" onclick="JavaScript:selecionarAgenda(${item.idAgenda},'${item.agenda}',${item.idLocalAtend},'${item.local}', 0, '');">${item.agenda}</a></th>
</tr>
</c:forEach>
</thead>
</table>
Javascript:selectAgenda
function selecionarAgenda(idAgenda, nomeAgenda, idlocal, local, idmedico, medico){
document.forms[0].sc.value=document.getElementById("div1").scrollTop-2;
diaSemana();
if(idAgenda > 0){
document.formConsulta.selectMedico.value=0;
document.formConsulta.medico.value='';
document.formConsulta.idagenda.value=idAgenda;
document.formConsulta.nomeagenda.value=nomeAgenda;
document.formConsulta.selectLocal.value=idlocal;
document.formConsulta.local.value=local;
document.formConsulta.idtipoconsulta.value=4;
document.formConsulta.idmedico.value=0;
document.formConsulta.action='<%=request.getContextPath()%>/controlador?acao=agendaunica';
document.formConsulta.submit();
}else{
document.formConsulta.nomeagenda.value='';
document.formConsulta.idagenda.value=0;
document.formConsulta.idtipoconsulta.value=0;
document.formConsulta.idmedico.value=idmedico;
document.formConsulta.medico.value=medico;
MM_jumpMenu();
}
}
My Jsp
communicates with the servlet
controller? acao=scheduleunica thus making the page Ubmit after selecting the radio
. It would be possible to change the color of the radio selected after Submit because the user complains that he does not remember which Agenda is in.
I did it the first way, it worked, but you’re only getting the color on the first line. If I select another line for example, the background color only goes to first. Document.formConsulta.Linhatabela.value= idAgenda; and created the Document.addeventlistener("Domcontentloaded", Function(Event) { Document.getElementById("Linhatabela"). classname = "corFundo"; });
– Arthur Edson
Document.getElementById("Linhatable") . The id here must be the id of your calendar that Voce linked in your TR, by the ${item.idAgenda parameter}.
– Almer Nakano
yes, you are taking this parameter and assigning it in Document.formConsulta.idagenda.value=idAgenda; according to my javascript up there. ai I assign the row of the table <tr id="idagenda" > and did the method Voce posted, and is not changing the color
– Arthur Edson
Try debugging and check if the expected parameter is coming in the id of your Row where you are adding the class: Document.getElementById("id") must be equal to the parameter <%=selection%> so this way it will only take the selected element. You can run via console for testing.
– Almer Nakano