the sample in that link is simple below and there is no submit action on select function,
<script type="text/javascript">
$(document).ready(function() {
$("#<TextBoxControlId>").autocomplete('<Url of handler>');
});
</script>
if you want to do something with the select function of autocomplete, try the method Wozer suggested.
$(".AutoComp").autocomplete({
source: function(request, response) {
...
},
select: function (e, i) {
//change the code to implement your requirement here
}
});
If this can not solve your problem, please explain your situation in more detail for anyone to help you. Thanks.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
kirank28
Participant
792 Points
551 Posts
jquery autocomplete how to stop page submitting on selection.
Apr 30, 2012 03:32 PM|LINK
hi ,
i am using jquery autocomplete using this http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx
here everthing is fine, only my concern is when i select any item from the list it auto get submit the page
can any one have idea how i can stop that being submit the page.
Wozer
Member
390 Points
267 Posts
Re: jquery autocomplete how to stop page submitting on selection.
Apr 30, 2012 06:52 PM|LINK
you need to do something with the select function of autocomplete, for example:
$(".AutoComp").autocomplete({ source: function(request, response) { $.ajax({ url: "ServiceURL", data: JSON.stringify({prefixText:request.term, count:10}), dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", success: function(data) { response($.map(data.d, function (item) { return { label: item.split(':')[0], val: item.split(':')[1] } })) }, error: function(response) { alert(response.responseText); }, failure: function(response) { alert(response.responseText); } }); }, select: function (e, i) { $('#hidResult').val(i.item.val); }, minLength: 1 });Hope that helps,
Chris
kirank28
Participant
792 Points
551 Posts
Re: jquery autocomplete how to stop page submitting on selection.
May 01, 2012 09:43 AM|LINK
hi thankx for the reply,
i am not getting exactly how i can use the above one can you plz help me to get exact code.
Wozer
Member
390 Points
267 Posts
Re: jquery autocomplete how to stop page submitting on selection.
May 01, 2012 01:32 PM|LINK
Kirank,
I would suggest reading up on the Jquery Autocomplete documentation to understand how everything works.
It can be found here:
http://jqueryui.com/demos/autocomplete/#default
kirank28
Participant
792 Points
551 Posts
Re: jquery autocomplete how to stop page submitting on selection.
May 01, 2012 03:21 PM|LINK
hi , thanx for the reply
yes i have allready gone thr with this, and at last i m not able to solve that onselect auto submit page .
can any one help me to do so.
thankx
asteranup
All-Star
30184 Points
4906 Posts
Re: jquery autocomplete how to stop page submitting on selection.
May 02, 2012 05:21 AM|LINK
Hi,
You can check multiple implementation of autocomplete here-
http://delicious.com/anupdg/autocomplete
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
Yanping Wang...
Star
14863 Points
1527 Posts
Microsoft
Re: jquery autocomplete how to stop page submitting on selection.
May 02, 2012 07:55 AM|LINK
Hi kirank28,
Do you mean the autocomplete sample of http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx will auto submit page after select any item?
the sample in that link is simple below and there is no submit action on select function,
<script type="text/javascript"> $(document).ready(function() { $("#<TextBoxControlId>").autocomplete('<Url of handler>'); }); </script>if you want to do something with the select function of autocomplete, try the method Wozer suggested.
$(".AutoComp").autocomplete({ source: function(request, response) { ... }, select: function (e, i) { //change the code to implement your requirement here } });If this can not solve your problem, please explain your situation in more detail for anyone to help you. Thanks.
Feedback to us
Develop and promote your apps in Windows Store