views:

49

answers:

1

hello I'm using JQuery Autocomplete (bassistance) and have run into a problem. if i select by pressing ENTER(Return key) it just displayed in the text box and i need to press one more enter to search (submit the form) is there is any way to make the form submit on single select....

A: 

Try using the result function to submit the form once you have selected a value.

 $('#textbox').autocomplete( ...your data and options... )
              .result( function(e,data,formatted) {
                   $('#textbox').value( formatted );
                   $('form').submit();
               });

I don't recall off the top of my head, but I think that the result handler will be called instead of the default action of filling the input so I think you'll need to stuff the value in the input before submitting as I've shown.

tvanfosson
`$("#q").autocomplete('?hl=suggestions', { .result( function() { width:350, max: 10, highlight: false, scroll: true, scrollHeight: 300, selectFirst: false, autoFill: true,matchContains: true, minChars: 0, formatResult: function(data, value) { return value.split(".")[0]; } $('form').submit(); }); });`
sing
i tried like this but not working
sing