1
My doubt is a little complicated to explain, but come on. I have several Checkboxs, where it is not mandatory to select them to do the search, are only search parameters, my question, how to do this search "relative"? The parameters are the selected checkboxes. I’m not sure how to do this. If anyone can help me. A picture of the checkboxs :
Thought I’d do it like this, my JS:
var checkeds = new Array();
$("input[name='marcar[]']:checked").each(function (){
checkeds.push( $(this).val());
});
var obj = $("#paramsPesquisa");
if($(obj).find("input[id='cd_seq_pedido']:checked").length > 0){
var cd_seq_pedido = $(obj).find("input[id='cd_seq_pedido']:checked").val();
}else{
var cd_seq_pedido = "";
}
Ajax method :
$.ajax({
type: "POST",
url: "/pedidoOnline/index.php/Pedidos/checkbox_marcados",
data: {
'marcar':checkeds,
'cd_seq_pedido': cd_seq_pedido,
'cd_pedido': cd_pedido
},
success: function(data){
console.log(data);
}
});
And then in the controller, how to mount this "relative" Query because it will only be what the user selects, being only possible 1 result selected by checkbox.
I want to bring these Fields, but how to put the conditions here ?
$pesquisa = $this->PesquisaPedOnline->find('all', array(
'fields' => array('cd_seq_pedido', 'cd_pedido', 'ds_cpl_tamanho_interno'),
'conditions' => array(
?????
)
));`
Dude, but what exactly are the data you’re looking for, what Oce wants to display with this data?
– Ruggi