0

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)
};
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by werm
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.