Hello,

I'm building an intranet site for work with an autocomplete feature. I have it working to where when the user clicks on the name in the autocomplete list, it will fill that value to the text input box. What I need it to do is after it fills in the value, also submit the form, à la Google. I would usually research how to do this, but I'm on a tight schedule and really need your help! Here's what I have for the code so far.

function suggest(a) {
    if (a.length == 0) {
        $("#suggestions").fadeOut()
    } else {
        $("#search").addClass("load");
        $.post("autosuggest.php", {
            queryString: "" + a + ""
        },


        function (b) {
            if (b.length > 0) {
                $("#suggestions").fadeIn();
                $("#suggestionsList").html(b);
                $("#search").removeClass("load")
            }
        })
    }
}
function fill(a) {
    $("#search").val(a);
    setTimeout("$('#suggestions').fadeOut();", 300)
};

in what order do you want them executed

When the user clicks the name <li>, I would like for it to
1.) Fill the search field with the value that was clicked (already does that)
2.) Submit that value to the search.

I know I have to use document.formname.submit, but I can't get it to both, all I can get is one or the other.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.