My question is a little complicated to explain, but come on. I have several checkboxes, where it is not mandatory to select them to do the search, just are search parameters, my question, how to do this "relative search"? Parameters are the checked checkboxes. I'm not sure how to do this. If anyone can help me. An image of checkboxs:
Ithoughtofdoingso,myJS:
varcheckeds=newArray();$("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, with only 1 result selected by checkbox being possible.
I want to bring these fields, but how do I put the conditions here?
$pesquisa = $this->PesquisaPedOnline->find('all', array(
'fields' => array('cd_seq_pedido', 'cd_pedido', 'ds_cpl_tamanho_interno'),
'conditions' => array(
?????
)
));'