Creating a form that reads the parameters from the URL and can by used by IE7

W

wherez73

Hi,

IE7 has a search bar from which you can search on the internet. It is
also possible to add a site to the list of sources for this bar. The
only disadvantage of this is that it pass the full text entered in the
search bar as one search term to the destination site. This is no
problem for Google but it is for sites like the Dutch phonebook
(http://www.detelefoongids.nl). These kind of sites are using more
than one search term, each separated. E.g. Name and City.

So what I am planning to do is to create my own search page and split
the arguments in the URL and use them to redirect to the phonebook
site.

The exact URL used by the phone book is
http://dtgi.detelefoongids.nl/dtgi/...homepage&type=basic&wie=jansen&waar=amsterdam
where "jansen" is the name of the person and "amsterdam" the city.
"Wie" is the dutch translation of who and "waar" stands for
"location".

Basically this is what I have planned:
1) Create a form with two fields, name and city;
2) When clicking on submit it will forward the visitor to the URL
mentioned above by passing the values of the form fields to this URL;
3) The form must also be able to read the values from the URL passed
from the IE7 search bar (see below for more information);
4) When the IE7 search bar is used the form must submit automatically.

Note for the 3th point above:
Because IE7 will pass all text as one term to the destination site the
URL of my page, opened from the search bar, will be something like
"http://domain.com/phonebook.html?terms=<name> <city>". As you can see
the name and city are not separated. These are in this format
undetectable by any script in the form. The only way to separate them
is to let the user add a character manually when entering the text in
the search bar. For example: name+city. In this case the URL for my
page, opened from the search bar, will be "http://domain.com/
phonebook.html?terms=<name>+<city>".
As you see the form must be able to separate the name and the city by
using a + sign as the separator.

I am only partially able to create a page with this form. Is somebody
out there who is able to set this thing up?

Regards,

Jasper
 
S

shimmyshack

Hi,

IE7 has a search bar from which you can search on the internet. It is
also possible to add a site to the list of sources for this bar. The
only disadvantage of this is that it pass the full text entered in the
search bar as one search term to the destination site. This is no
problem for Google but it is for sites like the Dutch phonebook
(http://www.detelefoongids.nl). These kind of sites are using more
than one search term, each separated. E.g. Name and City.

So what I am planning to do is to create my own search page and split
the arguments in the URL and use them to redirect to the phonebook
site.

The exact URL used by the phone book ishttp://dtgi.detelefoongids.nl/dtgi/ZoekInDeTelefoongids.do?locationTy...
where "jansen" is the name of the person and "amsterdam" the city.
"Wie" is the dutch translation of who and "waar" stands for
"location".

Basically this is what I have planned:
1) Create a form with two fields, name and city;
2) When clicking on submit it will forward the visitor to the URL
mentioned above by passing the values of the form fields to this URL;
3) The form must also be able to read the values from the URL passed
from the IE7 search bar (see below for more information);
4) When the IE7 search bar is used the form must submit automatically.

Note for the 3th point above:
Because IE7 will pass all text as one term to the destination site the
URL of my page, opened from the search bar, will be something like
"http://domain.com/phonebook.html?terms=<name> <city>". As you can see
the name and city are not separated. These are in this format
undetectable by any script in the form. The only way to separate them
is to let the user add a character manually when entering the text in
the search bar. For example: name+city. In this case the URL for my
page, opened from the search bar, will be "http://domain.com/
phonebook.html?terms=<name>+<city>".
As you see the form must be able to separate the name and the city by
using a + sign as the separator.

I am only partially able to create a page with this form. Is somebody
out there who is able to set this thing up?

Regards,

Jasper

this is really about /server/ side logic
you have two types of data neither of which have a specific format.
so just assume the user enters
name, location
or
name location
then use server side logic to split the words up,

there are only a few reasonable variants which will cover 99% of all
cases.

Try to match the location from the list in your database, I assume you
have all the locations in question in a database. (for instance here
in England having only 45000 location names will get almost everwhere
from the tiny hamlet to the largest city and its regions)
There's no point returning anything unless they have entered the
location correctly anyway. (unless you use SOUNDEX to return likely
mistakes)
If you cant find a match for the lcoation widen the match to include
the last two words and try that, then return a soundex match, and a
hint "lastname, location"

It will work fine, with just 20ms more database time than before.
If you want to have a list of names in there as well, and use reg exp
or other matching, that will work too. Lists are available on the net.
 
S

scripts.contact

Basically this is what I have planned:
1) Create a form with two fields, name and city;
2) When clicking on submit it will forward the visitor to the URL
mentioned above by passing the values of the form fields to this URL;

3) The form must also be able to read the values from the URL passed
from the IE7 search bar (see below for more information);
4) When the IE7 search bar is used the form must submit automatically.
------
window.location.href.match(/.*\?.*?terms=(.*?),(.*)/i)
name=RegExp.$1;city=RegExp.$2
if(RegExp.$1 && RegExp.$2)
window.location.replace("http://dtgi.detelefoongids.nl/dtgi/
ZoekInDeTelefoongids.do?
locationType=LOCALITY&req_source=homepage&type=basic&wie="+name
+"&waar="+city)
------
 
S

scripts.contact

<html>
<head><title> Title </title>
<script type="text/javascript">
window.location.href.match(/.*\?.*?terms=(.*?),(.*)/i)
name=RegExp.$1;city=RegExp.$2
if(RegExp.$1 && RegExp.$2)
replUR(name,city)


function goSubmit(){
formElm=document.forms["redirct"]
replUR(formElm.nm.value,formElm.ct.value)
}

function replUR(n,c){
location.replace("http://...mepage&type=basic&wie="+n+"&waar="+c)
}

</script>
</head>
<body>
<form action="#" onsubmit="goSubmit();return false" name="redirct">
Name: <input name="nm" type=text><br>
City: <input name="ct" type=text><br>
<button type="submit">Go >></button>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top