Link to home
Start Free TrialLog in
Avatar of flashactions
flashactions

asked on

How can I search mutiple forms at once?

I have put togeather some search boxes from different sites onto one page for students at my workplace.  How can I set it up so that i can search multiple sites using one search box?  if you take a look at my page you will see alll the search boxes.   I would like to search many of those boxes at once.  

http://mail.cpsd.us/~jgraham/home%20page.html
Avatar of dolcezzza
dolcezzza

ASKER CERTIFIED SOLUTION
Avatar of dolcezzza
dolcezzza

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of b0lsc0tt
flashactions,

You really need to involve a server page and script then.  Will your web server support a server language?  If so which (e.g. ASP, PHP, Perl)?

With the server language you can submit the one box to a server page and have it use that info for a number of "processes."  That server page could get all of the results and then display them at once on a page.  I don't really know what you want the result page to look like but it seems it could get pretty ugly if you are searching a number of sites.

If you want to avoid trying to "combine" the results then you may try iframes to show the different search sites and results.  If you do this then Javascript alone would work to submit the input from the search box to the various sites.

Let me know if you have any questions or need more information.

b0lsc0tt
Avatar of flashactions

ASKER

I dont really need to display them lal togeather,  I dont even need I frames.  They could all pop up in their own window for all i cre.  just wanted to be able to combine the searches.  so if you know a way i could do it with java,  hook it up.
the thunderstone solution was nice,  but the vortex scripting and and installing it on the web server is a little mutch.   Im working in a school,  so vortex is out of the question due to where the files are being stored.  
Sorry if Java is the server language you would use and what you need this in then I won't be able to help.  I just haven't had a chance to learn it yet.  Please confirm that is the language you need this in and I will add the Java zone to this question.

Java (and any other server language) won't be able to display the results in different windows though.  A server language sends the response back to the same browser that "called" it.  That response (i.e. html) could contain javascript that can open new windows but that wouldn't work well to display the results.

bol
I have not tried the google site specific search.  But im guessing that its not what im looking for.  I think that will search all the dispayed text on the page.  I am searching the databases of some of these sites (I think).  

And java would probably be the language im looking for.   But is there no way to do it with html?  one big form that will incorporate all the other forms i put togeather?  Like would it be possible to put multiple action statemtns in the form declaration?

<form action="http://www.2nd site.com"  action="http://www.3rd site.com" action="http://www.wikipedia.org/search-redirect.php" method="get" target="_blank">
that won't work. You definately need to put another language in there.
From the example you posted, the google one looks like it could be edited to suit your needs. If you are searching outside sites like in your example, any info you can get, google will get.
You may be able to do a javascript function that does everything, but I am not that experienced in it either. Maybe let them move your question to java.
ok well i see a way to do it but i need to customize it for the searches i want  heres the code i found here on ee
<script>
function submitForm(form)
{
     document.forms[0].target="_blank";
     document.forms[0].action="http://www.google.com/custom";
     document.forms[0].submit();
     document.forms[0].action="http://www.wikipedia.org/search-redirect.php";
     document.forms[0].submit();

     return false;
}
</script>

<form onsubmit="return submitForm(this)">

then I how would I add the parameters for the form?   well here are 2 of the forms parameters that i want to include.  One is for wikipedia and one is for google.  

"wikipedia"
<input type="hidden" name="language" value="en"/>
                          <input type="text" name="search" size="20"/>
                          <input type="submit" name="go" value="Search"/>
                                            </form>

"google"
 <input type="text" name="q" size="20" maxlength="255" value="" id="sbi" />
                          <input type="submit" name="sa" value="Search" id="sbb" />
                      </form>


                   
for this code you would have 1 submit button/ search form.
You would add any of them here:
{
     document.forms[0].target="_blank";
     document.forms[0].action="http://www.google.com/custom";
     document.forms[0].submit();
     document.forms[0].action="http://www.wikipedia.org/search-redirect.php";
     document.forms[0].submit();

Open in new window

1 submit button / search form is what im looking for.      so adding them in there is what i need help with.  
form would only have:

<form onsubmit="return submitForm(this)">
<input type="hidden" name="language" value="en"/>
                          <input type="text" name="search" size="20"/>
                          <input type="submit" name="go" value="Search"/>
                                            </form>
document.forms[0].target="_blank";
     document.forms[0].action="http://www.google.com/custom";
     document.forms[0].submit();
     document.forms[0].action="http://www.wikipedia.org/search-redirect.php";
     document.forms[0].submit();
     document.forms[0].action="http://www.whateverothersite.com/custom";
     document.forms[0].submit();
     document.forms[0].action="http://www.anothersite.org/search-redirect.php";
     document.forms[0].submit();

Open in new window

also, check ... you might have to change the numbers [0] on a submit and action, [1] on a submit and action etc...
ok well when i impliment this script the wikipedia search works but the others do not and i think that is because that text box name for the wikipedia search is "search" , google text input box is named "q" and the quotations text box is named "homesearch"

<html>
<head>
<script>
function submitForm(form)
{
     document.forms[0].target="_blank";
     document.forms[0].action="http://www.google.com/custom";
     document.forms[0].submit();
     document.forms[0].action="http://www.wikipedia.org/search-redirect.php";
     document.forms[0].submit();
     document.forms[0].action="http://www.quotationspage.com/search.php3";
     document.forms[0].submit();
     return false;
}
</script>
</head>
<body>
<form onsubmit="return submitForm(this)">
<input type="hidden" name="language" value="en"/>
                          <input type="text" name="search" size="20"/>
                          <input type="submit" name="go" value="Search"/>
                                            </form>
</body>
</html>
thats the script that i just tried that would only search wikipedia.

here are the complete forms that i want to combine.  

<form action="http://www.quotationspage.com/search.php3" method="get" name="searchform" target="_blank" id="searchform">
<input type="text" name="homesearch" size="20" value="" />
<input type="submit" name="startsearch" id="startsearch" value="Search" />
</form>


<form action="http://www.wikipedia.org/search-redirect.php" method="get" target="_blank">
<input type="hidden" name="language" value="en"/>
<input type="text" name="search" size="20"/>
<input type="submit" name="go" value="Search"/>
</form>

<form method="get" action="http://www.google.com/custom" target="google_window">
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="20" maxlength="255" value="" id="sbi" />
<input type="submit" name="sa" value="Search" id="sbb" />
</form>
try changing the #s:
document.forms[0].target="_blank";
     document.forms[0].action="http://www.google.com/custom";
     document.forms[0].submit();
     document.forms[1].action="http://www.wikipedia.org/search-redirect.php";
     document.forms[1].submit();
     document.forms[2].action="http://www.quotationspage.com/search.php3";
     document.forms[2].submit();

Open in new window

yeah i gave that a shot,  no luck,  the problem is i need to pass the parameters for each search.  because all 3 have their own parameters it uses to query their databases.    
this is exactly w3hat i was looking for,  but the server at my school does not support it,  but thats what i am looking for to the T
Please explain why you closed this as you did.  From an earlier comment it seemed that solution wouldn't work (http:#20786286).

b0lsc0tt
EE Zone Advisor
The solution would not work for me becuse i am at a school with web space that  barely supports flash,  so the vortex programming language would not work here.  But that is the correct answer to my question,  and no progress was being made,  so i closed it.
I am just guessing here(from a limited knowledge of javascript)... you'd have to research it a bit, but can you put more parameters in each maybe? Such as:
document.forms[0].action="http://www.google.com/custom";
     document.forms[0].some other function
  document.forms[0].some other function
  document.forms[0].submit();


I have seen other scripts for other things done this way, it may be worth a shot.

Thank You for giving me the points anyway, I wish I could be of more help!
this comes from a verification script, but it may lead you in the right direction:
"Finally, you can change the ACTION of a form if you want to:

document.forms[0].action = 'the_other_script.pl';

This can come in very handily if a form has to be submitted to another script in some cases.
"

source: http://www.quirksmode.org/js/forms.html