Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search using multiple text boxes

Status
Not open for further replies.

ScrabbleKing

Programmer
Mar 11, 2007
20
0
0
US
I am trying to get 1 text box displayed in the top right table when the 'Google' is selected which changes to 4 text boxes displayed in the same area when 'Mapquest' is selected.

I am trying to get it so when Mapquest is selected and the user enters the street in the first text box, city in the second text box, state in the third text box, and zip code in the fourth text box then hits submit that it will display Mapquests results.

The top set of code is what I currently have done. The bottom set of code works at opening up Mapquest's results. I don't know how to merge the two. Can someone please help?

Code:
<body>
<script>

function displayInputs(num){
var inputs = document.getElementById('inputs');
inputs.innerHTML = "";
for(i=0; i<num; i++){
var newInput = document.createElement('input');
newInput.id = 'input' + i;
newInput.maxlength = "2048";
newInput.name = "q";
newInput.size = "20";
newInput.title = "Search string";
newInput.value = "";
inputs.appendChild(newInput);
}
}


function DoIt()
{
  f = document.getElementById("qform");
	if (f.engine[0].checked)
			{
			f.action="[URL unfurl="true"]http://www.google.com/search"[/URL]
			}

	else	if (f.engine[1].checked)
			{
			// ????????????????????????????????????
			}
}

</script>



<div style="text-align:center">

<form method="get" action="[URL unfurl="true"]http://www.google.com/search"[/URL] name="qform" id="qform" onsubmit="DoIt()">
		<input name="hl" type="hidden" value="en">

<table width="757"><tr><td width="1" valign="top">
<A href="[URL unfurl="true"]http://www.example.com"[/URL] // this is the website address it goes to
target=_blank rel=nofollow><IMG height=99 
alt="Example" 
border="1" width=132
</a></a></td>

<td width="916" align="center">
<br>
        <p>
		<div id="inputs">
		<input maxlength="2048" name="q" size="20" title="Search string" value="">
		</div>
		<input type="hidden" name="p">
		<input name="btnG" type="submit" value="Submit">
		<input type="reset" name="clear" value="&nbsp;&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;&nbsp;">&nbsp;&nbsp;&nbsp;&nbsp;
		</div>
</table>

<table width="756">
<br><br>
	<div style="text-align:center">
		<input id="Google" onclick="displayInputs(1);" type="radio" checked value="Google" name="engine"><font face="arial" size="2"><b>Google</b></font><br>
		<input id="Mapquest" onclick="displayInputs(4);" type="radio" value="Mapquest" name="engine"><font face="arial" size="2"><b>Mapquest</b></font><br>
</table>

</form>
</body>

Code:
<form action="[URL unfurl="true"]http://www.mapquest.com/maps/map.adp"[/URL] method="get">
<table cellpadding="3" cellspacing="0" border="0" style="font: 11px Arial,Helvetica;">
<td colspan="2">Address/Intersection:</td></tr>
<tr><td colspan="2"><input type="text" name="address" size="20" maxlength="80"></td></tr>
<tr><td colspan="2">City:
<td>State:</td><td>ZIP Code:</td></tr>
<tr><td colspan="2"><input type="text" name="city" size="20" maxlength="80"></td>

<td><input type="text" name="state" size="3" maxlength="2"></td><td><input type="text" name="zipcode" size="10" maxlength="12"></td></tr>
<tr><td colspan="2" style="text-align: center;"><input type="submit" value="Get Map"><input type="hidden" name="CID" value="lfmapwid"><input type="hidden" name="country" value="US"></td></tr>
</table>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top