lundi 12 janvier 2015

text field with autocomplete and multiple selection checkboxes

I would like to add checkboxes functionality to the destination field in my application which is using autocomplete functionality. I am able to retrieve the list of destinations from DB2 with jquery automplete and ajax call. However, I would like to add checkboxes for all the suggestions that appear, so that I can select more than one destination at a time.


current scenario:


When I enter a character or a string, the ajax call will query the database and retrieve all the matching destination values and through jquery autocomplete, I am able to display the result on UI.


However, My requirement is to add check boxes infront of each suggestion displayed on UI. jquery with ajax call:



$("#destinationName").autocomplete({

source : function(request, response) {
$.ajax({
url : "${pageContext.request.contextPath}/showDestinations",
type : "POST",
data : {
term : request.term
},
dataType : "json",
success : function(data) {
response(data);
}
});
}
});


html code for destination field:



<input type="text" id="destinationName" name="destinationName" value="${emsMonitoringForm.destinationName}"
class="field" />


kindly suggest me, how can i acheive this functionality. Thanks !





Aucun commentaire:

Enregistrer un commentaire