vendredi 16 janvier 2015

autocomplete checkboxed values need to be set in the text or text area field

I am very new to UI development and in a learning stage. However, I have a task to complete, I tried by my best, but I am unable to find the solution.


My requirement: for the autocomplete checkboxes, the selected checkboxes values have to be set into respective text or textarea field. Once I click on search button, the selected checkbox values have to be sent to the controller page, so that I can retrieve these values on controller side and carry on with the later part. But I am stuck when it comes to UI. Kindly advise me.


jquery autocomplete + checkbox functionality: working fine



$("#destinationName").autocomplete({
source : function(request, response) {
$.ajax({
url: "${pageContext.request.contextPath}/showDestinations",
type: "POST",
data: { term : request.term },
dataType: "json",
success: function(data) {
$('.dest').html("");
$.each(data, function(i, record) {
$('.dest').append("<br/><input class= 'src' type='checkbox' id='chk-" + i + "' name='" + record + "' /> " + record);
});


HTML



<form method="post" id="searchForm" action="someAction/showStatistics" id="ems">
<label>Destination</label>
<input type="text" id="destinationName" name="destinationName" value="${someForm.destinationName}" class="field" />
<div class="dest"></div>
<input type="submit" class="button" value="search" />
</form>




Aucun commentaire:

Enregistrer un commentaire