PDA

View Full Version : Validating google site-search


trigger_tre
12-03-2006, 04:41 AM
OK I am redesigning my church website for better functionality and started working on the search engine.

I am trying to build it so thats its xhtml strict compliant. I succesfully changed a few things in the google site-flavored search engine code so that it would validate under these standards.

However at the moment I have to keep the radio button as is. If I remove it and do a search the results displays results from the entire web, and not just my site as I would like it to.

Ok my test page is http://harvestwhitecounty.com/newtest.php

This is the code originally given to me by google...
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.com/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">

</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="harvestwhitecounty.com"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="25" maxlength="255" value="" id="sbi"></input>
</td></tr>
<tr>
<td>&nbsp;</td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="harvestwhitecounty.com" checked id="ss1"></input>
<label for="ss1" title="Search harvestwhitecounty.com"><font size="-1" color="#000000">harvestwhitecounty.com</font></label></td>
</tr>
</table>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Google Search" id="sbb"></input>
<input type="hidden" name="client" value="pub-1495259235454738"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000 000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:200;L:http://harvestwhitecounty.com/image/harvest_logo.jpg;S:http://harvestwhitecounty.com/image;FORID:1"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->

:eek: TABLES.....OMG! It obviously didnt comply with strict XHTML so I altered it a little to this...

<form method="get" action="http://www.google.com/custom">
<div>
<input type="hidden" name="domains" value="harvestwhitecounty.com" />
<input type="text" name="q" size="25" maxlength="255" value="" id="sbi" />
<input type="radio" name="sitesearch" value="harvestwhitecounty.com" id="ss1" />
<input type="submit" name="sa" value="Search" id="sbb" />
<input type="hidden" name="client" value="pub-1495259235454738" />
<input type="hidden" name="forid" value="1" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<input type="hidden" name="oe" value="ISO-8859-1" />
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000 000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:200;L:http://harvestwhitecounty.com/image/harvest_logo.jpg;S:http://harvestwhitecounty.com/image;FORID:1" />
<input type="hidden" name="hl" value="en" />
</div>
</form>

With it coded like this it validates and works properly but the radio button is still there and I am unsure of how to delete it so my results are from my site only, not the entire web.

thanks in advance,

-trigger

oracleguy
12-03-2006, 07:12 AM
Change the type from radio to hidden. That should do the trick. That way the value is still passed when the form is submitted but it isn't shown.

trigger_tre
12-03-2006, 07:33 AM
Worked.

thank you.

-trigger