Avatar

Level 2

Hi, I have linked a pdf form with access DB successfully but I’ve got a problem with it populating the fields.

There are two countries (US and UK) with 4 states for US and 5 for the  UK. So, if the user selects US the first drop-down list only displays 2  states out of the 4 that should be displayed. The second drop-down list  displays the other 2. If the UK is selected, the first drop-down list  will display 3 of the 5 states and the second drop-down list will  display the other 2. So it seems to be splitting the states across the 2  drop-down lists.

Here is the code:
 
form1.#subform[0].ddlCity::exit - (JavaScript, client)

var oDataConn = xfa.sourceSet.DataConnectionCOUNTY.clone(1);
 
oDataConn.nodes.item(1).query.select.nodes.item(0).value = "SELECT * FROM COUNTIES WHERE CITY_ID = " + this.rawValue;

oDataConn.open();

ddlCounty.clearItems();

ddlCounty.rawValue = "";

Text1.clearItems();

Text1.rawValue = "";

while(!oDataConn.isEOF())

{

     ddlCounty.addItem(xfa.record.DataConnectionCOUNTY.NAME.value, xfa.record.DataConnectionCOUNTY.ID.value);

     oDataConn.next();

     Text1.addItem(xfa.record.DataConnectionCOUNTY.NAME.value, xfa.record.DataConnectionCOUNTY.ID.value);

     oDataConn.next();

}

oDataConn.close();