0
I am unable to send the selected options when I enter the code below. Out of code is working.
the page receives information and assembles the box according to the requests that came, so it is possible to withdraw orders and while doing this the screen needs to update to do some things on the server.
The problem is time to pass the remaining orders in the box to the server, in this piece of code I am not able to select the requests to send. In console.log it already informs that the value is null.
I’m referring to the last Else, everything else works.
Any idea?
'''
$("#PedidoSelecionado").on("change",function(){
$("#PedidoDisponivel").append($("#PedidoSelecionado option:selected").clone(true));
$("#PedidoSelecionado option:selected").remove();
ordenarOptions("PedidoDisponivel");
ordenarOptions("PedidoSelecionado");
<cfif variables.MensaErro neq "">
if($("#PedidoSelecionado > option").length == 0){
$("#PedidoSelecionado").addClass("is-invalid");
$("#PedidoSelecionado").removeClass("is-valid");
erro = true;
mensagem = "<strong>Você precisa selecionar pelo menos um pedido.</strong><br>";
$(".container-fluid .alert-danger").html(mensagem)>
$(".container-fluid .alert-danger").show("slow",function(){
setTimeout(function(){
$(".container-fluid .alert-danger").hide("slow");
},
3000);
});
}
else{
$("#PedidoSelecionado option").each(function(){
$(this).attr("selected",true);
});
console.log($("#PedidoSelecionado").val());return;
ChamaRotina('Estoque','Pedido',$("#PedidoSelecionado").val());
}
</cfif>
});
'''
Oops @Eliseu B. Boy, I have this code you described on the page, but at this point it didn’t work. I managed to solve with the following code:
– Robson Cabral
var options = $('#Requestselected option'); var values = $.map(options ,Function(option) { Return option.value; }); Chamarotina('Storing','Orders',values); "Thank you"
– Robson Cabral
Okay, good that it was solved, when asking a question, make reference of versions you are using, if there are also dependencies and so can work an answer in the scenario of your doubt, facilitates, good luck.
– ElvisP