Solved

Is it possible to modify a google search box to search a site without using a radio button?

Posted on 2008-10-25
3
212 Views
Last Modified: 2012-05-05
I'm trying to add a google search box to my site. I want it to search only my site "www.glowfishtw.com". I don't want to give the user the option to search the whole web. I've tried adding:

             <input type="hidden" name="domains" value="www.glowfishtw.com" />

to my search form, but it doesn't work. If I use this:

            <input type="radio"  name="sitesearch" value="www.glowfishtw.com" checked />

the search works. Is there a way to make this radio button hidden? or maybe another way to go about this?

Thanks.
here is my whole code:

<form method="get" action="http://www.google.com/custom">
                  &nbsp;
                  <input type="text" name="q" size="16" maxlength="255" value="" />
                              <input type="submit" name="btnG" value="Search" />
                              <input type="radio"  name="sitesearch" value="www.glowfishtw.com" checked />
                              site search <br />

                               <input type="hidden" name="domains" value="www.glowfishtw.com" />


                        </form>      
0
Comment
Question by:elliottbenzle
3 Comments
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 200 total points
ID: 22806040
Hi Elliott,

I've not been able to figure out why Google doesn't allow this.   What I think you can do instead is just not display the radio button:

<input type="radio"  name="sitesearch" value="www.glowfishtw.com" checked style="display: none"/>

0
 
LVL 5

Accepted Solution

by:
DecKen earned 300 total points
ID: 22806042
Try this

form method="get" action="http://www.google.com/custom">

                  &nbsp;

                  <input type="text" name="q" size="16" maxlength="255" value="" />

                              <input type="submit" name="btnG" value="Search" />

                              <input type="hidden"  name="sitesearch" value="www.glowfishtw.com"/> 

                              site search <br />
 

                               <input type="hidden" name="domains" value="www.glowfishtw.com" />
 
 

                        </form> 

Open in new window

0
 
LVL 4

Author Comment

by:elliottbenzle
ID: 22807101
       <input type="hidden" name="sitesearch" value="www.glowfishtw.com" />

this did it. Thanks severyone.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now