...

View Full Version : The Amazing, Disappearing Code



superwookie
07-27-2012, 07:52 PM
So I'm working on a project for my company. After rising through the ranks, I've finally made it to a place where I can impact the company by re-designing the internal procedural manuals to be way more efficient than before. I'm having a heck of a time, though, with a particular piece of code. I wasn't sure if I should post this here in the JS section, so I'll post here and ask the mods to move it should they feel it's better suited for JS.

I have a form that I'm using to search multiple websites depending upon where the user needs to look for information. The form can search either the website that they're on, another department's internal website, or our company's external website.

Here's the header code. FYI, I changed some site names to preserve the company's anonymity.



<script type="text/javascript">
function decide(form)
{
var searchTerm = form.search.value;
var f;
switch( form.where.selectedIndex )
{
case 0:
alert("You must choose where to search"); return;
case 1:
f = document.getElementById("fash"); // internal
f.d.value = searchTerm;
search_form(f);
return;
case 2:
f = document.getElementById("olqb"); // add this id or similar
f.UserRestriction.value = searchTerm;
f.submit();
return;
case 3:
f = document.getElementById("google"); // or your id
f.q.value = searchTerm;
f.submit();
return;
case 4:
f = document.getElementById("dotcom");
f.keyword.value = searchTerm;
f.submit();
return;
}
}
</script>


...and the body code for the form.



<p class="three" style="text-align: center;">
<form>
<input name="search"/>
<select name="where">
<option>--choose where to search--</option>
<option>Fraud Team Homepage</option>
<option>OLQB</option>
<option>Google</option>
<option>mycompany.com</option>
</select>
<input type="button" value="SEARCH" onclick="decide(this.form);"/>
</form>
</p>

<div style="visibility: hidden;"> <form id="fash" name="jse_Form" onsubmit="search_form(jse_Form);return false">
<input type="text" name="d" size="30" style="visibility: hidden;">
<input type="button" value="Fraud Homepage Search" onclick="search_form(jse_Form)" style="visibility: hidden;">
</form>

<!--webbot bot="Search" S-Index="all" S-Fields S-Text="Search for:" I-Size="20" S-Submit="Start Search" S-Clear="Reset" S-TimestampFormat="%m/%d/%Y" TAG="BODY" b-useindexserver="1" startspan -->
<form id="olqb" action="Search.htm0.idq" method="POST"><input type="text" name="UserRestriction" size="30" value style="visibility: hidden;">
<input type="submit" value="OLQB Search" style="visibility: hidden;"></form>
<!--webbot bot="Search" i-checksum="4210" endspan -->


<form id="google" method="get" action="http://www.google.com/search">
<input type="text" name="q" size="30" maxlength="233" value="" style="visibility: hidden;">
<input type="submit" value="Google Search" style="visibility: hidden;">
</form>

<form id="dotcom" method="get" action="http://mycompany.com">
<input class="input" type="text" name="keyword" size="30" style="visibility: hidden;">
<input type="hidden" name="origin" value="keywordsearch" /><input id="go" class="button" tabindex="0" type="submit" value="mycompany.com Search" style="visibility: hidden;">
</form>
</div>


So far, so good. Here's the weird part:

I've used the code before on another project for my company without problems. However, in this new project, whenever I save the .html file, the following code gets removed from the file:



<form id="olqb" action="Search.htm0.idq" method="POST"><input type="text" name="UserRestriction" size="30" value style="visibility: hidden;">
<input type="submit" value="OLQB Search" style="visibility: hidden;"></form>
<!--webbot bot="Search" i-checksum="4210" endspan -->


The code gets completely removed. If I save the file and keep it open, the code still shows; however, once I run the page for testing in IE, if I go to view the source the code does not show and the search function with the ID of OLQB does not work. I'm forced (very much against my will) to use Frontpage as a development tool for the project, but even if I open the file in Notepad and edit the code, I still run into the same problems.

It should be noted that the rest of the search functions continue to work as designed.

I'm completely flummoxed about what to do here. Can anyone give me any thoughts?

TL;DR I have Houdini for a search form.

DrDOS
07-27-2012, 08:11 PM
This may be an error:
<!--webbot maybe should be <!-- webbot
But it's not important, the fact that you have visibility:hidden; in two places may be. Is there javascript in one version that unhides those elements?

superwookie
07-27-2012, 08:40 PM
Are you referring to the fact that I have



style="visibility: hidden;"


In both my text and submit? Or are you concerned that the DIV itself is hidden in addition to the text/submit fields?

DrDOS
07-27-2012, 08:48 PM
Just look in the js of the working page and see if there is anything that unhides them. If there is, put it in the other page. If not, plan B.

superwookie
07-27-2012, 08:59 PM
Sorry, forgot to answer that question. There's nothing in the JS of the working page that unhides them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum