Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
gente eu tenho um filtro todo em ajax, dai faço todos os filtros ou simplesmente digito a palavra chave e aperto enter e ele ñ aceita, tem q clicar no botão com mouse e muitos usuários pensam q ñ funciona o sistema por causa disso, bom o botão é assim:
if (($resGet[3])== ', 0') {
echo '<tr><td height=10></td></tr>';echo'<font class="font_cliente_roxo">Endereço:</font> <font class="font_cliente">'.$resGet[3].'</font></br>';
}
Alguém tem alguma idéia? desde já muito obrigado!
ñ de certo ñ, acho até q coloquei algo faltando no código do bt q é assim:
<div align="center">
<input type="button" onClick="ajaxGetBusca('<?= session_id(); ?>')" name="button" value="Buscar!" id="button" style="font-family:Arial;width:150px;background-color: #FFD200;border:1px solid #F68A1F; font-weigth: bold;">
<br>
pra se ter uma idéia melhor do q estou falando ai vai a imagem:
/applications/core/interface/imageproxy/imageproxy.php?img=http://essenciapropaganda.com.br/cliente/bizoovale/busca.jpg&key=6d6a0186442175b72457ce580cddff6bb7d8d86322711eaaa017b7c56cd9468f" alt="Imagem Postada" />
desde já obrigado!
Olá. Faz assim:
Coloque o botão como submit e SEM ONCLICK e a função do onclick coloca do onsubmit do formulário.
mas o bt onclik chama um lance em ajax e sem isso ele ñ vai chamar e tem outro detalhe isso ñ fica dentro de um form, veja isso completo:
<div align="center"><br>
<select name="cidade_id" onChange="ajaxGetBairro(this.value);" id="cidade_id" style="font-family:Arial;width:150px;">
<option value="0">Todas as Cidades...</option>
<?php
// recuperando as cidades
$sqlGetCidade = "SELECT DISTINCT(a.cidade_id), a.cidade_nome
FROM tbl_cidade AS a INNER JOIN tbl_cliente AS b
ON a.cidade_id = b.cidade_id INNER JOIN tbl_cliente_segmento AS c
ON b.cliente_id = c.cliente_id
ORDER BY cidade_nome ASC";
$conGetCidade = $objConn->queryDb($sqlGetCidade) or die (mysql_error());
while ($resGetCidade = $objConn->aRow($conGetCidade)) {
echo "<option value=".$resGetCidade[0].">".$resGetCidade[1]."</option>";
}
?>
</select>
</div>
<div style="padding-top: 6px; padding-bottom: 3px;">
<div align="center">
<select name="bairro_id" onChange="ajaxGetSegmento(this.value);" id="bairro_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Bairros...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="segmento_id" onChange="ajaxGetSuSegmentoCombo(this.value)" id="segmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Segmentos...</option>
<?php
// recuperando as cidades
$sqlGetSeg = "SELECT DISTINCT (
a.segmento_id
), a.segmento_desc
FROM tbl_segmento AS a
INNER JOIN tbl_cliente_segmento AS b ON a.segmento_id = b.segmento_id
INNER JOIN tbl_cliente AS c ON b.cliente_id = c.cliente_id
ORDER BY a.segmento_desc ASC";
$conGetSeg = $objConn->queryDb($sqlGetSeg) or die (mysql_error());
while ($resGetSeg = $objConn->aRow($conGetSeg)) {
echo "<option value=".$resGetSeg[0].">".$resGetSeg[1]."</option>";
}
?>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="subsegmento_id" id="subsegmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Subsegmentos...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input name="str_search" type="text" id="str_search" style="font-family:Arial;width:150px;">
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input type="button" onClick="ajaxGetBusca('<?= session_id(); ?>')" name="button" value="Buscar!" id="button" style="font-family:Arial;width:150px;background-color: #FFD200;border:1px solid #F68A1F; font-weigth: bold;">
<br>
</div>
</div>
Dai me pergunto:
Será que por ñ estar dentro de um form deveria ter um comando em ajax? ou eu colocaria td dentro de um form, mas como?
coloca dentro de um form. Vai chamar o ajax sim, por que o evento é onSubmit (ao enviar) e o botão é submit (enviar). Ou seja, ao clicar no botão ou pressionar enter, vai enviar, e o onsubmit (ao enviar) vai rodar o ajax.
ficaria assim?
<form>
<div align="center"><br>
<select name="cidade_id" onchange="ajaxGetBairro(this.value);" id="cidade_id" style="font-family:Arial;width:150px;">
<option value="0">Todas as Cidades...</option>
<?php
// recuperando as cidades
$sqlGetCidade = "SELECT DISTINCT(a.cidade_id), a.cidade_nome
FROM tbl_cidade AS a INNER JOIN tbl_cliente AS b
ON a.cidade_id = b.cidade_id INNER JOIN tbl_cliente_segmento AS c
ON b.cliente_id = c.cliente_id
ORDER BY cidade_nome ASC";
$conGetCidade = $objConn->queryDb($sqlGetCidade) or die (mysql_error());
while ($resGetCidade = $objConn->aRow($conGetCidade)) {
echo "<option value=".$resGetCidade[0].">".$resGetCidade[1]."</option>";
}
?>
</select>
</div>
<div style="padding-top: 6px; padding-bottom: 3px;">
<div align="center">
<select name="bairro_id" onchange="ajaxGetSegmento(this.value);" id="bairro_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Bairros...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="segmento_id" onchange="ajaxGetSuSegmentoCombo(this.value)" id="segmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Segmentos...</option>
<?php
// recuperando as cidades
$sqlGetSeg = "SELECT DISTINCT (
a.segmento_id
), a.segmento_desc
FROM tbl_segmento AS a
INNER JOIN tbl_cliente_segmento AS b ON a.segmento_id = b.segmento_id
INNER JOIN tbl_cliente AS c ON b.cliente_id = c.cliente_id
ORDER BY a.segmento_desc ASC";
$conGetSeg = $objConn->queryDb($sqlGetSeg) or die (mysql_error());
while ($resGetSeg = $objConn->aRow($conGetSeg)) {
echo "<option value=".$resGetSeg[0].">".$resGetSeg[1]."</option>";
}
?>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="subsegmento_id" id="subsegmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Subsegmentos...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input name="str_search" type="text" id="str_search" style="font-family:Arial;width:150px;">
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input type="submit" onclick="ajaxGetBusca('<?= session_id(); ?>')" name="button" value="Buscar!" id="button" style="font-family:Arial;width:150px;background-color: #FFD200;border:1px solid #F68A1F; font-weigth: bold;">
<br>
</div>
</div>
</form>cara, o onclick o botão FICA VAZIO, ELE NEM EXISTE. a função vai pro onsubmit do form:
<form onsubmit="ajaxGetBusca('<?= session_id(); ?>');">
<div align="center"><br>
<select name="cidade_id" onchange="ajaxGetBairro(this.value);" id="cidade_id" style="font-family:Arial;width:150px;">
<option value="0">Todas as Cidades...</option>
<?php
// recuperando as cidades
$sqlGetCidade = "SELECT DISTINCT(a.cidade_id), a.cidade_nome
FROM tbl_cidade AS a INNER JOIN tbl_cliente AS b
ON a.cidade_id = b.cidade_id INNER JOIN tbl_cliente_segmento AS c
ON b.cliente_id = c.cliente_id
ORDER BY cidade_nome ASC";
$conGetCidade = $objConn->queryDb($sqlGetCidade) or die (mysql_error());
while ($resGetCidade = $objConn->aRow($conGetCidade)) {
echo "<option value=".$resGetCidade[0].">".$resGetCidade[1]."</option>";
}
?>
</select>
</div>
<div style="padding-top: 6px; padding-bottom: 3px;">
<div align="center">
<select name="bairro_id" onchange="ajaxGetSegmento(this.value);" id="bairro_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Bairros...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="segmento_id" onchange="ajaxGetSuSegmentoCombo(this.value)" id="segmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Segmentos...</option>
<?php
// recuperando as cidades
$sqlGetSeg = "SELECT DISTINCT (
a.segmento_id
), a.segmento_desc
FROM tbl_segmento AS a
INNER JOIN tbl_cliente_segmento AS b ON a.segmento_id = b.segmento_id
INNER JOIN tbl_cliente AS c ON b.cliente_id = c.cliente_id
ORDER BY a.segmento_desc ASC";
$conGetSeg = $objConn->queryDb($sqlGetSeg) or die (mysql_error());
while ($resGetSeg = $objConn->aRow($conGetSeg)) {
echo "<option value=".$resGetSeg[0].">".$resGetSeg[1]."</option>";
}
?>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<select name="subsegmento_id" id="subsegmento_id" style="font-family:Arial;width:150px;">
<option value="0">Todos os Subsegmentos...</option>
</select>
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input name="str_search" type="text" id="str_search" style="font-family:Arial;width:150px;">
</div>
</div>
<div style="padding-top: 3px; padding-bottom: 3px;">
<div align="center">
<input type="submit" name="button" value="Buscar!" id="button" style="font-family:Arial;width:150px;background-color: #FFD200;border:1px solid #F68A1F; font-weigth: bold;">
<br>
</div>
</div>
</form>esta aparecendo
Você tem um erro de sintaxe no seu SQL próximo a '' na linha 14
puts, pq será? rs...
onkeydown="if(event.keyCode==13) document.NOMEFORM.submit();"
isso demtro do form que tenho q criar, né?
Coloque um submit para seu Form...
type="SUBMIT"