I have created the textbox in infopath ,Here I have used auto suggest control for a textbox, I will load value and ID in that text box , on selecting a value in auto suggest on the textbox an id will be generated for that selected value, I need to store that is in another text box,on post back the stored ID is getting cleared in that text box is there any solution for this.
window.onload = function() {
window.setTimeout(getData, 1000);
}
function getData(){
getState();
window.setTimeout(getData, 1000);
}
function getState(){
var state = [];
$().SPServices({
operation: "GetListItems",
listName: "state",
CAMLViewFields: "",
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
state.push({label:$(this).attr("ows_Column2"),value:$(this).attr("ows_ID")});
});
}
});
$("input[id$='FormControl0_V1_I1_T22']").autocomplete({
source: state,
minLength: 2,
change: function (event, ui) {
},
select: function( event, ui) {
alert(ui.item ? ("You picked '" + ui.item.label + "' with an ID of " + ui.item.value) : "Nothing selected, input was " + this.value);
$("input[id$='FormControl0_V1_I1_T22']").val(ui.item.label);
$("input[id$='FormControl0_V1_I1_T23']").val(ui.item.value);
return false;
},
focus: function(event, ui){
event.preventDefault();
$("input[id$='FormControl0_V1_I1_T22']").val(ui.item.label);
return false;
}
});
}
Thanks in advance.