[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

More troubles with dual search input forms

Posted on 2002-05-15
9
Medium Priority
?
230 Views
Last Modified: 2010-04-09
At http://www.dcross.net/dh/stardotgeek.htm I have a search box that uses two buttons. Based on information I recieved here earlier, this is how it works:

----
<form method="get">
<input type="hidden" name=q>
<input type="hidden" name=t>
<input type="text" name="search" size="60" maxlength="255"></font></td></tr><tr><td>

<input type="submit" value="&nbsp;Google Search&nbsp;" onclick="this.form.q.value = this.form.search.value; this.form.action
= 'http://www.google.com/search';">
<input type="submit" value="&nbsp;Teoma Search&nbsp;" onclick="this.form.t.value = this.form.search.value;this.form.action
= 'http://www.teoma.com/search.asp';">
----

The problem now is that when I type anything in the box and press enter, it simply reloads the page. I actually have to click one of the two search buttons to search, when really I want Google to be the "default" search. Any ideas how to get around this without using any form of javascript?
0
Comment
Question by:Decimal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 7012979
<input type="button" value="&nbsp;Teoma Search&nbsp;" onclick="this.form.t.value = this.form.search.value;this.form.action
= 'http://www.teoma.com/search.asp';">


see if this works
0
 
LVL 2

Accepted Solution

by:
Marianne earned 800 total points
ID: 7013301
<form method="get" action="http://www.google.com/search">
<input type="hidden" name=t>
<input type="text" name="q" size="60" maxlength="255"></font></td></tr><tr><td>

<input type="submit" value="&nbsp;Google Search&nbsp;">
<input type="submit" value="&nbsp;Teoma Search&nbsp;" onclick="this.form.t.value = this.form.q.value;this.form.action = 'http://www.teoma.com/search.asp';">

This way it will Google-search without using javascript at all.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 7013368
since I was the author of that code, I invoke privilege and say that all you have to do is add to the action attribute of the form and leave the code as is:

<html>
<head>
<title>Search Submission</title>
</head>
<body>
<form method="get" action="http://www.google.com/search">
<input type="hidden" name="q">
<input type="hidden" name="t">
<input type="text" name="search" size="40" maxlength="255">
<input type="submit" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.action = 'http://www.google.com/search';">
<input type="submit" value="Teoma Search" onclick="this.form.t.value = this.form.search.value;this.form.action = 'http://www.teoma.com/search.asp';">
</form>
</body>
</html>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 23

Expert Comment

by:b1xml2
ID: 7013370
and just to add that leveret posted the answer first =))
0
 

Author Comment

by:Decimal
ID: 7013904
Problem solved! Now I've got another. B1xml2 wrote the original code, leveret posted the answer first. Who gets the answer points? :p
0
 

Author Comment

by:Decimal
ID: 7014052
Okay, looking over it again, leveret's code works better. B1xml2, your code takes it to google when I press "enter", but the page is blank after the logo at the top of the page.

Thanks, everyone.
0
 
LVL 2

Expert Comment

by:Marianne
ID: 7014098
There should be *absolutely* no difference of how the two variants of this code work. The thing that a page appears to be blank must have some other reason (probably blank field instead of some text in the form, or just bad connection)

The only difference is that my code is a bit shorter and thus probably more graceful. However it doesn't affect the results.

I don't really care much who will get the points, I don't eat points :) My opinion also is, that the rules of giving points in this forum takes away the pleasure of friendly conversation, making it formal and somewhat too commercial :-\
0
 

Author Comment

by:Decimal
ID: 7014134
I wasn't concerned about the points myself, just who to give the "official" credit to since that's a reasonable requirement to get an answer. But did you actually try putting both codes in seperate text files and seeing what happens when you run them in IE? I did, several times. Probably some small gramatical error that makes the page come up blank.
0
 
LVL 2

Expert Comment

by:Marianne
ID: 7015014
Just noticed. You are right, Decimal.

[ input type="text" name="search" ] should be replaced with [ input type="text" name="q" ] in the b1xml2's example. It will work quite as well then.

Good luck ;)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question