Gossamer Forum
Home : Products : DBMan SQL : Discussion :

What is the URL?

Quote Reply
What is the URL?
I want to add a map to my web page. Next to the map I want to have a few radio buttons. The user will select the radio buttons and then click a State on the map to do a search. What code do I add to make this happen. I currently have the following but it does not work:

<form name="search_form" action="http://www.mydomain.com/cgi-bin/dbsql/db.cgi" method=post><div align="right">
<p><font size="2"> <img src="Mapsa.gif" border="0" usemap="#sa">
<input type="radio" name="radiobutton" value="radiobutton">yes</font></p><p><font size="2">
<input type="radio" name="radiobutton" value="radiobutton">no <br></font>
<input type=hidden name="db" value="homes">
<input type=hidden name="do" value="search_results">
<input type=hidden name="dp" value="1">
<input type=hidden name="uid" value="default">
<input name=dsn type=hidden value="139">
</form>
Quote Reply
Re: [needsupport] What is the URL? In reply to
Which product are you using? I notice you posted this in the dbman forum too.

Last edited by:

RedRum: Mar 12, 2002, 2:18 AM
Quote Reply
Re: [needsupport] What is the URL? In reply to
Hi,

You should create the link for each State, it should be:

db.cgi?db=<%db%>&do=search_results&uid=default&dp=1&State=State_ID

TheStone.

B.
Quote Reply
Re: [TheStone] What is the URL? In reply to
The link works fine thank you. But what I want to do is also include a few radio buttons with the map. So for instance the user can select the radio button and also select a region on the map. The code you have supplied only allows one to select the region on the map and not the radio buttons at the same time.

Look forward to your reply.
Quote Reply
Re: TheStone - Can you help? In reply to
I want to select one of the radio buttons and then click a region of the map to do a search. so if I have 3 radio buttons, the user will select one of the radio buttons and the select a region on the map to do the search.

Here is the code:

<p align="left"><font size="2">number of people interested </font></p><p align="left"><font size="2"> <input type="radio" name="radiobutton" value="radiobutton">single</font><font size="2">
<input type="radio" name="radiobutton" value="radiobutton">couple <input type="radio" name="radiobutton" value="radiobutton">
family <img src="Mapsa.gif" width="337" height="350" border="0" usemap="#sa"><br>
</font><input type=hidden name="db" value="homes"><input type=hidden name="do" value="search_results"><input type=hidden name="dp" value="999999"><input type=hidden name="uid" value="default"></p>
Quote Reply
Re: [needsupport] What is the URL? In reply to
Hi,

In this case, you have to use javascript to creare url for the map. Follow step-by-step instructions below to try it out:

- Add the javascript into html file:

<script language='javascript'>
function create_url () {
var obj = document.frmname.rtype;
var type;
for (var i=0; i < obj.length; i++) {
if (obj.checked) type = obj.value;
}

var url = window.location.protocol + '//' + window.location.hostname + window.location.pathname + "?db=<%db%>&do=search_results&uid=default&dp=1&State=State_ID&field_of_type=" + type
window.location = url
}
</script>

<form name=frmname method=post>
.......
<input type=radio name=rtype value='single'>Single
<input type=radio name=rtype value='couple'>Couple
<input type=radio name=rtype value='family'>Family
....
</form>

- The link on the map should be:
<a href="javascript:create_url()">


Hope that helps.

TheStone.

B.
Quote Reply
Re: [TheStone] What is the URL? In reply to
Thanks I think I am nearly there. When I run it it does not work. Is this code complete:
<a href="javascript:create_url()">

You said I should put this in the map.

Also here is the code for the page:

<html>
<head>
<script language='javascript'>
function create_url () {
var obj = document.frmname.rtype;
var type;
for (var i=0; i < obj.length; i++) {
if (obj.checked) type = obj.value;
}

var url = window.location.protocol + '//' + window.location.hostname + window.location.pathname + "?db=<%db%>&do=search_results&uid=default&dp=1&State=Accom&field_of_type=" + type window.location = url
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#0000FF" vlink="#0000FF" alink="#0000FF">
<div id="Layer5" style="position:absolute; width:744px; height:74px; z-index:6; left: 94px; top: 72px">
<form name=myform method=post>
<p>Select State:</p>
<p>.......
<input type=radio name=State value='NSW'>
NSW
<input type=radio name=State value='Victoria'>
VIC
<input type=radio name=State value='Northern Territory'>
NT .... </p>
<p><font size="2"><img src="Mapsa.gif" width="337" height="350" border="0" usemap="#sa"></font>
</p>
</form>

</div>
<map name="sa">
<area shape="rect" coords="2,0,329,188" href="&lt;a href=&quot;javascript:create_url()&quot;&gt; ">
</map>
</body>

</html>
Quote Reply
Re: [needsupport] What is the URL? In reply to
Hi,

You have to change
var obj = document.frmname.rtype;
To:
var obj = document.myform.State;

Also, the url should be:
var url = window.location.protocol + '//' + window.location.hostname + window.location.pathname + "?db=<%db%>&do=search_results&uid=default&dp=1&State=" + type;
window.location = url;

TheStone.


B.

Last edited by:

TheStone: Mar 12, 2002, 4:12 PM
Quote Reply
Re: [TheStone] What is the URL? In reply to
I want to search for different regions on the map. You mentioned in your post to use the code: <a href="javascript:create_url()"> in the map. How does it know which fields to search for? Is there any other code I need to add here.

Also in the method post do I only need to have the following:

<form name=myform method=post>

The page is on a static page not in the sql folders. Should I put <form name=myform method=post action="http://www.mydomain.com/cgi-bin/dsql/dp.cgi">

Thanks for your help- I really need this to work
Quote Reply
Re: [needsupport] What is the URL? In reply to
Change the script a bit:

function create_url (region) {
...
var url = window.location.protocol + '//' + window.location.hostname + window.location.pathname + "?db=<%db%>&do=search_results&uid=default&dp=1&State=" + type + "&Region=" + region;
...
}


And the link should be:
<a href="create_url('region_name')">

'State' and 'Region' are fields to search for.
In this case, you don't have to put the method and action for form tag.

TheStone.

B.

Last edited by:

TheStone: Mar 12, 2002, 4:37 PM
Quote Reply
Re: [TheStone] What is the URL? In reply to
I am nearly there except for the link. I added the link and when I do a search I get an error with URL:
http://www.mydomain.com/<a%20href="create_url('AccomAny')">

The source code is:

<html>
<head>
<script language='javascript'>
function create_url () {
var obj = document.frmname.rtype;
var type;
for (var i=0; i < obj.length; i++) {
if (obj.checked) type = obj.value;
}

var url = window.location.protocol + '//' + window.location.hostname + window.location.pathname + "?db=<%db%>&do=search_results&uid=default&dp=1&State=" + type + "&Region=" + region;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#0000FF" vlink="#0000FF" alink="#0000FF">
<div id="Layer5" style="position:absolute; width:744px; height:74px; z-index:6; left: 94px; top: 72px">
<form name=myform method=post action="http://www.mydomain.com/cgi-bin/dsql/dp.cgi">
<p>Select State:</p>
<p>.......
<input type=radio name=State value='NSW'>
NSW
<input type=radio name=State value='Victoria'>
VIC
<input type=radio name=State value='Northern Territory'>
NT .... </p>
<p><font size="2"><img src="Mapsa.gif" width="337" height="350" border="0" usemap="#sa"></font>
</p>
</form>

</div>
<map name="sa">
<area shape="rect" coords="2,1,329,189" href="&lt;a href=&quot;create_url('AccomAny')&quot;&gt; ">
</map>
</body>

</html>