0
I have a jsp page of a legacy code. A piece of it is as follows:
<form name="frm_pedido" method="post" action='<%=(flgPrimeiroPedido ? "/pedidoConfirmaEndereco.jsp" : "finaliza_pedido.jsp")%>' onsubmit="javascript: return false;">
<input type="hidden" name="sem_inter2" value="<%=erro2%>">
<input type="hidden" name="list_sem_inter2" value="<%=areasFuncionaisSemInter%>">
</form>
This variable areasFuncionaisSemInter
is a Java ArrayList
of Strings
. The problem is that when clicking a button on the page, I need to pass this list to a JS function and extract its values. The function called when clicking the button is the VerificaInter()
. I tried the following:
function VerificaInter() {
if(document.frm_pedido.sem_inter2.value == 'true') {
var iterator = document.frm_pedido.list_sem_inter2.values();
alert('Os valores da lista sao:\n');
iterator; // nao funcionou dessa forma...
// logica pra iterar na lista e exibir os valores
return false;
}
else {
return true;
}
}
This variable iterator
didn’t work that way and I couldn’t iterate over the list and extract its values. What I’m doing wrong and how I could perform this operation?