Javascript is copying my target text to the wrong box?
<p>So I have an autocomplete search box on my page's template. I have another page that uses this template that I need a second box on. I've changed the code so that box work on the same page, except that when I click from the drop-down div to select the data, it copies it from the additional field to the original field. </p>

<p>First search box (from template)</p>

<pre><code>    function lookup(inputString) {
            if(inputString.length == 0) {
                    // Hide the suggestion box.
                    $('#suggestions').hide();
            } else {
                    $.post("http://targetsite.com/assets/search/autocomplete.php", {queryString: ""+inputString+""}, function(data){
                            if(data.length &gt;0) {
                                    $('#suggestions').show();
                                    $('#autoSuggestionsList').html(data);
                            }
                    });
            }
    } // lookup

    function fill(thisValue) {
            $('#inputString').val(thisValue);
            setTimeout("$('#suggestions').hide();", 200);
    }
    function passValue(val)
    {
        if(!val) {
    return false;
}

    document.forms[1].action = "http://targetsite.com/dashboard/sourceview" + "/" + val;
    return true;
</code></pre>

<p>}</p>

<p>And the corresponding HTML:</p>

<pre><code>&lt;div class="sidebarsearch" align="right"&gt;
        &lt;div id="search"&gt;
                Server Search
                &lt;form onsubmit="passValue(document.getElementById('inputString').value)" method="post" accept-charset="utf-8" name="search"&gt;
                &lt;input type="text" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" autocomplete="off" placeholder="search" /&gt;
                &lt;input type="submit" value=" go " /&gt;

                &lt;!-- the display box --&gt;
                &lt;div class="suggestionsBox" id="suggestions" style="display: none;"&gt;
                        &lt;div class="suggestionList" id="autoSuggestionsList"&gt;&lt;/div&gt;
                &lt;/div&gt;
                &lt;/form&gt;
        &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The additional search box javascript:</p>

<pre><code>&lt;!-- autocomplete search box --&gt;
&lt;script type="text/javascript"&gt;

function diffLookup(diffInputString) {
        if(diffInputString.length == 0) {
                // Hide the suggestion box.
                $('#diffSuggestions').hide();
        } else {
                $.post("http://targetsite.com/assets/search/autocomplete.php", {queryString: ""+diffInputString+""}, function(data){

                if(data.length &gt;0) {
                        $('#diffSuggestions').show();
                        $('#diffAutoSuggestionsList').html(data);
                }
        });
        }
}

function diffFill(thisValue) {
        $('#diffInputString').val(thisValue);
        setTimeout("$('#diffSuggestions').hide();", 200);
}

function diffPassValue(val) {
        if(!val) {
                return false;
        }

        document.forms[1].action = "&lt;?php echo base_url("dashboard/sourceview"); ?&gt;" + "/" + val;
        return true;
}

&lt;/script&gt;
</code></pre>

<p>and that box's HTML:</p>

<pre><code>&lt;div class="diffHostSearch"&gt;
        &lt;div id="diffServer"&gt;
                &lt;form onsubmit="diffPassValue(document.getElementById('diffInputString').value)" method="post" accept-charset="utf-8" name="diffSearch" id="diffSearch"&gt;
                        &lt;input type="text" id="diffInputString" name="diffInputString" onkeyup="diffLookup(this.value);" onblur="diffFill();" autocomplete="off" placeholder="search" /&gt;
                        &lt;input type="submit" value=" go " /&gt;

                        &lt;!-- the display box --&gt;
                        &lt;div class="diffSuggestionsBox" id="diffSuggestions" style="display: none;"&gt;
                                &lt;div class="diffSuggestionList" id="diffAutoSuggestionsList"&gt;&lt;/div&gt;
                        &lt;/div&gt;
                &lt;/form&gt;
        &lt;/div&gt;
&lt;/div&gt;
</code></pre>
