Forum Moderators: open

Message Too Old, No Replies

Hide a form with javascript based on URL

Need javascript code to hide form from displaying on certain webpages

         

stumped

2:30 am on Jun 23, 2009 (gmt 0)

10+ Year Member



Does anyone have code for hiding a form from displaying on certain webpages but not on others. I want the results to be that if the URL filename query string is ?Search= that the form does not display but if the filename query string is ?cat= then the form will display.

Here's the form code:
<form name="RefineSearchForm" action="SearchResults.asp" method="get">
<font size=2><b>
</b></font>
<select name="RefineBy_#*$!" onChange="this.form.submit()" class="RefineSearch">
<option value="">Find By type</option>
<option value="YYY">Type 1 (5)</option>
<option value="ZZZ">Type 2 (6)</option>
</select>
<input type="hidden" name="Search" value="something">
</form>

Can a javascript be used in the <html><head> of a file to accomplish this based on the form name or the css class? I do not have access to all parts of the page but do have access to the websites template header and footer.

Fotiman

1:50 pm on Jun 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is an example of where you would not want to use JavaScript. Search is probably a feature that you don't want to limit to users that have JavaScript enabled. The logic to show/hide the search form should be handled server side.