Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    67
    Thanks
    14
    Thanked 6 Times in 6 Posts

    The Amazing, Disappearing Code

    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.

    Code:
    <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.

    Code:
    	<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:

    Code:
         <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.
    Last edited by superwookie; 07-27-2012 at 07:54 PM. Reason: Added third-to-last sentence.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    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?

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    67
    Thanks
    14
    Thanked 6 Times in 6 Posts
    Are you referring to the fact that I have

    Code:
    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?

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    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.

  • #5
    New Coder
    Join Date
    Jul 2012
    Posts
    67
    Thanks
    14
    Thanked 6 Times in 6 Posts
    Sorry, forgot to answer that question. There's nothing in the JS of the working page that unhides them.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •