Page 1 of 1

Search tag and XHTML 1.0 Compliance

Posted: Wed Nov 30, 2005 10:43 pm
by rebaf
I included the "search" tag in my template and it was specified as XTML 1.0 strict, but whenever I attempted to validate the page I was getting several of the following error messages in the code generated by the "search" tag:

Code: Select all

document type does not allow element "Input" here; missing one of .... start-tag 

XHTML has a requirement to enclose each of the elements in a containing element. I found suitable for my purpose. In the script function.search.php in the plugins directory, I modified the last line of the smarty_cms_function_search function to read ...

Code: Select all

	return '<form method="get" action="http://www.google.com/search">
	<p><input type="hidden" name="ie" value="utf-8" /></p>
	<p><input type="hidden" name="oe" value="utf-8" /></p>
	<p><input type="hidden" name="sitesearch" value="'.$domain.'" /></p>
	<p><input type="text" id="textSearch" name="q" maxlength="255" value="" /></p>
	<p><input type="submit" id="buttonSearch" value="'.$buttonText.'" /></p>
	</form>';
BTW: This is CMSMS 10.4.

As far as I can tell this doesn't cause any problem in validating the page as HTML 4.01 strict, not sure about other standards.

This works for me, but your mileage may differ.

Re: Search tag and XHTML 1.0 Compliance

Posted: Tue Dec 13, 2005 1:33 am
by iNSiPiD
If you're using a Strict XHTML doctype and want to apply styles to your form the correct syntax is to surround the contents within the form with a DIV, not outside the form as one might expect.

i.e.


 
   
    ...
 
</form