<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Text box getting cleared on post back</title><link>https://www.infopathdev.com:443/forums/thread/95382.aspx</link><pubDate>Thu, 23 Jan 2014 08:07:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:95382</guid><dc:creator>Ramkumar</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/95382.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=95382</wfw:commentRss><description>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); //To handle IP&amp;#39;s form postback
}


function getState(){ 
var state = []; 
$().SPServices({ 
operation: &amp;quot;GetListItems&amp;quot;, 
listName: &amp;quot;state&amp;quot;,
CAMLViewFields: &amp;quot;&amp;quot;, 
async: false, 
completefunc: function (xData, Status) { 
$(xData.responseXML).SPFilterNode(&amp;quot;z:row&amp;quot;).each(function() { 
state.push({label:$(this).attr(&amp;quot;ows_Column2&amp;quot;),value:$(this).attr(&amp;quot;ows_ID&amp;quot;)});   
}); 
} 
}); 

$(&amp;quot;input[id$=&amp;#39;FormControl0_V1_I1_T22&amp;#39;]&amp;quot;).autocomplete({ 
source: state, 
minLength: 2, 
change: function (event, ui) {
},

select: function( event, ui) {
alert(ui.item ? (&amp;quot;You picked &amp;#39;&amp;quot; + ui.item.label + &amp;quot;&amp;#39; with an ID of &amp;quot; + ui.item.value) : &amp;quot;Nothing selected, input was &amp;quot; + this.value);

$(&amp;quot;input[id$=&amp;#39;FormControl0_V1_I1_T22&amp;#39;]&amp;quot;).val(ui.item.label);
$(&amp;quot;input[id$=&amp;#39;FormControl0_V1_I1_T23&amp;#39;]&amp;quot;).val(ui.item.value);
                return false;
        },

focus: function(event, ui){
event.preventDefault();
$(&amp;quot;input[id$=&amp;#39;FormControl0_V1_I1_T22&amp;#39;]&amp;quot;).val(ui.item.label);
          return false;
        }
});
}

Thanks in advance.</description></item></channel></rss>