Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
How to Make a Search Form With Multiple Search Options

I am trying to create a search form with a dropdown menu that allows visitors on a site to choose on which site to perform their search.

The dropdown menu offers a selection of sites to search.

So far, I got this far : https://biblio.brossard.ca/boite-de-recherche-test/.

Everything works great except when I use words with accented letters (é, ê, à, î, etc.) in the search box.

Here is the HTML code :

<form name="searchform" id="searchform" class="search-form" onSubmit="return dosearch();">
<div class="search-form-wrap">
<div class="selecteur">
<select name="sengines">
<option id="options" value="https://biblio.brossard.ca/?s=">Site Web</option>
<option id="options" value="https://catalogue.brossard.ca/query?q=" selected>Catalogue</option>
<option id="options" value="https://bibliothequemunicipaledebrossard.on.worldcat.org/v2/search?queryString=">Catalogue international</option>
</select></div><input type="text" name="searchterms" class="search-form-input" style="border-radius: 0 25px 25px 0; width: 70%; display: inline;" placeholder="Saisissez les termes de votre recherche."><input type="submit" name="SearchSubmit" id="searchsubmit" class="button submit-button" value="&#xf179;" />
</div>
</form>

And here is the javascript code :

<script type="text/javascript">
function dosearch() {
var sf=document.searchform;
var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value);
window.location.href = submitto;
return false;
}
</script>

So, how could I make a search form in which visitors on my site can select where to perform their search from a selection in a dropdown menu and the search will work with both words with and without accented characters?

Many thanks for your help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

First thing first The escape() function is deprecated. Although escape() is not strictly deprecated (as in "removed from the Web standards").

The escape() function computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.

escape('abc123');     // "abc123"
escape('äöü');        // "%E4%F6%FC"
escape('ć');          // "%u0107"

// special characters
escape('@*_+-./');    // "@*_+-./"

The escape function is a property of the global object. Special characters are encoded with the exception of: @*_+-./

The hexadecimal form for characters, whose code unit value is 0xFF or less, is a two-digit escape sequence: %xx. For characters with a greater code unit, the four-digit format %uxxxx is used.

Reference

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda