This is simple LiveCycle pdf form with 2 fields and a Button with attached click event and below code:
var inName = TextField1.rawValue
var nIndex = 0;
while(xfa.sourceSet.nodes.item(nIndex).name != "DataConnection")
var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1); // the node pertaining to the data connection specified
//set up sql call to DB to get specifics about employee
oDB.nodes.item(1).query.select.nodes.item(0).value = "Select * from COUNTRIES where COUNTRY_ID = '" + inName + "'";
//now connect to DB and get a record
So after insert country code in TextField1 and a Button click I obtain corresponding Country_Name in database binded field.
Everything works fine until I try to save the form, after reopen the Country_Name field restores it's default first database record.
I tried to assign the selected record to variable and than use it do write it's value to new static text field, which could be saved, but without success.
The final idea is to open clear or filled previously form insert/reinsert some index and after click find necessary data and save it all, so that when reopened the form is unchanged until next button click.
Any help would be appreciated!