Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Brunolerin

O botão ñ aceita "enter"

Recommended Posts

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>';
}else { 
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!

Compartilhar este post


Link para o post
Compartilhar em outros sites

ñ 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:

Imagem Postada

 

desde já obrigado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

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?

Compartilhar este post


Link para o post
Compartilhar em outros sites

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.

Compartilhar este post


Link para o post
Compartilhar em outros sites

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>

Compartilhar este post


Link para o post
Compartilhar em outros sites

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>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.