Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!