Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Add a hidden term to search

Posted on 2004-08-25
11
Medium Priority
?
216 Views
Last Modified: 2012-05-05
Hi

1.How can i add an unseen search term to one of these searches, so that for instance the first search is always loaded with the word "html" but the user cant see this.
Whatever keywords they add are added to "html" and the search looks for all of them.

2.How can I do this with more than one hidden term eg, "html" and "learn"

3.And can these terms be labelled as something other than "keywords" so that the search results don' t say, eg if the search term was 'div'
Results for html learn div...BUT
Results for div
--as the search is set up to say "Results for 'keywords' "

 - putting my last current lot of points up.

Thanks
====================
<form method="get">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>

</form>
0
Comment
Question by:macuser777
[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
  • 6
  • 5
11 Comments
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11897929
If you are using search.com's search engine, there is no way to control what it displays.  If you submit keywords to it, it will display them.  Do you still need help figuring how to append "html" to the beginning of your search term?
0
 
LVL 4

Author Comment

by:macuser777
ID: 11897955
I am using a product called smartsearch. I just put search in for example.

http://smarterscripts.com/smartsearch/

i'm playing with the script to try and make it a more focused search.

0
 
LVL 4

Author Comment

by:macuser777
ID: 11898520
..so yes help still required...appending terms would be a start anyway...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:trevorhartman
ID: 11898920
use a onSubmit event handler for your form, and append whichever keywords you want to the beginning of the input
0
 
LVL 4

Author Comment

by:macuser777
ID: 11899761
>>>      use a onSubmit event handler for your for your form, and append whichever keywords you want to the beginning of the input.

Can you supply an example of what you mean please.

0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11903814
<script>
function addTerms()
{
 document.forms[0].search.value = 'html ' + document.forms[0].search.value;
 return true;
}
</script>
<form method="get" onSubmit="addTerms()">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>

</form>
0
 
LVL 4

Author Comment

by:macuser777
ID: 11905047
My question asks for a hidden term to be added to ONE of the searches. This code adds it to both.

Also my qusetion asks for it to be a hidden term - this puts the added terms into the input box.
0
 
LVL 8

Expert Comment

by:trevorhartman
ID: 11905058
ok, this is because only 1 input can be submitted to the search.  I will get an example that allows it to be hidden.
0
 
LVL 8

Accepted Solution

by:
trevorhartman earned 320 total points
ID: 11914710
<form method="get">


  <table width="98%" border="0" align="center">
    <tr>
      <td> <div align="right">
          <input type="hidden" name="keywords">
     
          <input type="text" name="search" size="20" maxlength="255">
        </div></td>
      <td><div align="left">

          <input type="submit" style="width:110;text-align:center" value="Web Search" onclick="this.form.keywords.value = 'html' + this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/search/search.cgi?keywords ';">

          <input type="submit" style="width:110;text-align:center" value="Directory" onclick="this.form.keywords.value = this.form.search.value; this.form.action = ' http://www.search.com/cgi-bin/dirr/search/search.cgi?keywords ';">

                 </div></td>
    </tr>
  </table>
</form>
0
 
LVL 4

Author Comment

by:macuser777
ID: 11923432
Hi

That works well for my first 2 requests - very well actually. Thanks.

With regards to renaming the hidden term something other than 'keywords' - I guess that's probably another Q.

I'll leave it open for a while just in case - otherwise i'll ask that part in another q.

Thanks again

macuser
0
 
LVL 4

Author Comment

by:macuser777
ID: 11950894
thanks for your help :)
0

Featured Post

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.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

636 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