Dependent Select Issue

I have a form I have created to test the dependent select feature. The form is simple, only having two fields, each a drop down. If I select the value from the first field, then click on the second field, everything works as expected, returning a dependent field list in the second drop down.

However if I refresh the screen, choose the second field first (no good reason to do so, just expecting a user might do that), then choose a value from the first field, when I then choose the second field again it will no longer contact the database to get a dependent list of values to fill the second drop down. The developer console shows it is satified from cache, but it shouldn’t be with {vv_pharma_company_name:“DrugCompany1”} since I have not yet sent that name/value to the database. What am I doing wrong? I have tried this with v 6.5.1 and also v7 beta.

Here is my form:

isc.RestDataSource.create({
    ID:"combo1DS",
    recordXPath:"//record",
    fields:{
        vv_drug_id:{hidden:true, primaryKey:true, name:"vv_pharma_company_id"},
        vv_pharma_company_name:{title:"Drug Company", name:"vv_pharma_company_name", required:true}
    },
    dataFormat:"xml",
    useSimpleHttp:true,
    transformRequest : function (dsRequest) {

       // Avoid overriding _operationType, and any other values
        var data = this.Super('transformRequest', arguments)
       
             var params = {
                vv_operation_type : dsRequest.operationType
             };
       newData = {}

       for (var fieldName in data) {
          if (fieldName.startsWith("_")) continue;
              newData[fieldName] = data[fieldName];
       }
       return isc.addProperties({}, newData, params); 
 },
    dataURL:"/som/xml_sample_log_pharma_name"
})
isc.RestDataSource.create({
    ID:"combo2DS",
    recordXPath:"//record",
    fields:{
        vv_drug_id:{hidden:true, primaryKey:true, name:"vv_drug_id"},
        vv_drug_name:{title:"Drug Name", name:"vv_drug_name", required:true}
    },
    dataFormat:"xml",
    useSimpleHttp:true,
    transformRequest : function (dsRequest) {

       // Avoid overriding _operationType, and any other values
        var data = this.Super('transformRequest', arguments)
       
             var params = {
                vv_operation_type : dsRequest.operationType
             };
       newData = {}

       for (var fieldName in data) {
          if (fieldName.startsWith("_")) continue;
              newData[fieldName] = data[fieldName];
       }
       return isc.addProperties({}, newData, params); 
 },
    dataURL:"/som/xml_sample_log_drug_name"
})

isc.DynamicForm.create({
    id: "formID",
    name: "formID",
    width: 500,
    numCols: 4,
    fields: [
{
  name: "Combo1",
  title: "Combo 1",
  editorType: "comboBox",
  showOptionsFromDataSource: true,
  optionDataSource: "combo1DS",
  autoFetchData:true,
  valueField: "vv_pharma_company_name",
  displayField: "vv_pharma_company_name",
  change: "this.form.getField('Combo2').clearValue()"
},
{
  name: "Combo2", 
  ID: "Combo2",
  title: "Combo 2",
  editorType: "comboBox",
  showOptionsFromDataSource: true,
  optionDataSource: "combo2DS",
  valueField: "vv_drug_name",
  displayField: "vv_drug_name",
  getPickListFilterCriteria: function () {
    // return criteria based on the selection of Combo1 (or whatever else)
    var combo1Value = this.form.getValue('Combo1');
  
    return {vv_pharma_company_name : combo1Value};  // 
  }
}
    ]
});

Here is the developer console debug info for the normal situation when I choose the first field then the second. This works:

09:08:39.129:INFO:Log:initialized
09:08:39.955:INFO:ResultSet:isc_ResultSet_3:setCriteria: filter criteria changed, invalidating cache
09:08:39.955:INFO:ResultSet:isc_ResultSet_3:Invalidating cache
09:08:39.957:DEBUG:ResultSet:isc_ResultSet_3:getRange(0,1), cache check: 0,37 firstMissingRow: 0 lastMissingRow: 37
09:08:39.957:DEBUG:ResultSet:isc_ResultSet_3:getRange: guessing forward scrolling
09:08:39.957:INFO:ResultSet:isc_ResultSet_3:getRange(0, 1) will fetch from 0 to 75
09:08:39.958:INFO:ResultSet:isc_ResultSet_3:fetching rows 0,75 from server
09:08:39.959:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Finding records that match your criteria...
09:08:39.966:INFO:Log:isc.Page is loaded
09:08:39.967:INFO:RPCManager:Resubmitting transaction number: 0
09:08:39.967:INFO:RPCManager:sendQueue[0]: 1 RPCRequest(s); transport: xmlHttpRequest; target: /som/xml_sample_log_pharma_name
09:08:39.968:DEBUG:RPCManager:XMLHttpRequest GET from /som/xml_sample_log_pharma_name with fields: {vv_operation_type: "fetch"} full URL string: /som/xml_sample_log_pharma_name?vv_operation_type=fetch
09:08:40.047:XRP5:INFO:RPCManager:transaction 0 arrived after 80ms
09:08:40.057:XRP5:DEBUG:RPCManager:Result string for transaction 0: "<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>2</endRow>
<totalRows>2</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_pharma_company_name>DrugCompany1</vv_pharma_company_name>
  </record>
  <record>
    <vv_drug_id>2</vv_drug_id>
    <vv_pharma_company_name>DrugCompany2</vv_pharma_company_name>
  </record>
</data>
</response>
"
09:08:40.067:XRP5:INFO:RPCManager:rpcResponse(unstructured) results -->"<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>2</endRow>
<totalRows>2</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_pharma_company_name>DrugCompany1</vv_pharma_company_name>
  </record>
  <record>
    <vv_drug_id>2</vv_drug_id>
    <vv_pharma_company_name>DrugCompany2</vv_pharma_company_name>
  </record>
</data>
</response>
"<--
09:08:40.089:XRP5:INFO:ResultSet:isc_ResultSet_3:Received 2 records from server
09:08:40.105:XRP5:DEBUG:ResultSet:isc_ResultSet_3:full length set to: 2
09:08:40.120:XRP5:DEBUG:ResultSet:isc_ResultSet_3:integrating 2 rows into cache at position 0
09:08:40.136:XRP5:INFO:ResultSet:isc_ResultSet_3:cached 2 rows, from 0 to 2 (2 total rows, 2 cached)
09:08:40.151:XRP5:INFO:ResultSet:isc_ResultSet_3:Cache for entire DataSource complete
09:08:40.167:XRP5:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:08:40.182:XRP5:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:08:42.664:INFO:ResultSet:isc_ResultSet_3:setCriteria: filter criteria unchanged
09:08:42.681:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:08:42.705:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:08:45.222:INFO:ResultSet:isc_ResultSet_5:setCriteria: filter criteria changed, invalidating cache
09:08:45.241:INFO:ResultSet:isc_ResultSet_5:Invalidating cache
09:08:45.260:DEBUG:ResultSet:isc_ResultSet_5:getRange(0,1), cache check: 0,37 firstMissingRow: 0 lastMissingRow: 37
09:08:45.278:DEBUG:ResultSet:isc_ResultSet_5:getRange: guessing forward scrolling
09:08:45.295:INFO:ResultSet:isc_ResultSet_5:getRange(0, 1) will fetch from 0 to 75
09:08:45.312:INFO:ResultSet:isc_ResultSet_5:fetching rows 0,75 from server
09:08:45.332:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Finding records that match your criteria...
09:08:45.350:INFO:RPCManager:sendQueue[1]: 1 RPCRequest(s); transport: xmlHttpRequest; target: /som/xml_sample_log_drug_name
09:08:45.369:DEBUG:RPCManager:XMLHttpRequest GET from /som/xml_sample_log_drug_name with fields: {vv_pharma_company_name: "DrugCompany1",
vv_operation_type: "fetch"} full URL string: /som/xml_sample_log_drug_name?vv_pharma_company_name=DrugCompany1&vv_operation_type=fetch
09:08:45.401:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 10) satisfied from cache
09:08:45.433:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 25) satisfied from cache
09:08:45.460:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 25) satisfied from cache
09:08:45.503:XRP3:INFO:RPCManager:transaction 1 arrived after 135ms
09:08:45.523:XRP3:DEBUG:RPCManager:Result string for transaction 1: "<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>1</endRow>
<totalRows>1</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_drug_name>Ibuprofen</vv_drug_name>
  </record>
</data>
</response>
"
09:08:45.552:XRP3:INFO:RPCManager:rpcResponse(unstructured) results -->"<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>1</endRow>
<totalRows>1</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_drug_name>Ibuprofen</vv_drug_name>
  </record>
</data>
</response>
"<--
09:08:45.590:XRP3:INFO:ResultSet:isc_ResultSet_5:Received 1 records from server
09:08:45.611:XRP3:DEBUG:ResultSet:isc_ResultSet_5:full length set to: 1
09:08:45.632:XRP3:DEBUG:ResultSet:isc_ResultSet_5:integrating 1 rows into cache at position 0
09:08:45.654:XRP3:INFO:ResultSet:isc_ResultSet_5:cached 1 rows, from 0 to 1 (1 total rows, 1 cached)
09:08:45.676:XRP3:INFO:ResultSet:isc_ResultSet_5:Cache for current criteria complete
09:08:45.699:XRP3:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:08:45.722:XRP3:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 1) satisfied from cache
09:08:45.750:XRP3:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list

Here is the debug option if I refresh the screen, click on drop down 2, click on drop down 1 choosing a value, the clicking on drop down 2 again:

09:10:25.723:INFO:Log:initialized
09:10:26.531:INFO:ResultSet:isc_ResultSet_3:setCriteria: filter criteria changed, invalidating cache
09:10:26.531:INFO:ResultSet:isc_ResultSet_3:Invalidating cache
09:10:26.534:DEBUG:ResultSet:isc_ResultSet_3:getRange(0,1), cache check: 0,37 firstMissingRow: 0 lastMissingRow: 37
09:10:26.534:DEBUG:ResultSet:isc_ResultSet_3:getRange: guessing forward scrolling
09:10:26.534:INFO:ResultSet:isc_ResultSet_3:getRange(0, 1) will fetch from 0 to 75
09:10:26.534:INFO:ResultSet:isc_ResultSet_3:fetching rows 0,75 from server
09:10:26.536:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Finding records that match your criteria...
09:10:26.540:INFO:Log:isc.Page is loaded
09:10:26.540:INFO:RPCManager:Resubmitting transaction number: 0
09:10:26.540:INFO:RPCManager:sendQueue[0]: 1 RPCRequest(s); transport: xmlHttpRequest; target: /som/xml_sample_log_pharma_name
09:10:26.541:DEBUG:RPCManager:XMLHttpRequest GET from /som/xml_sample_log_pharma_name with fields: {vv_operation_type: "fetch"} full URL string: /som/xml_sample_log_pharma_name?vv_operation_type=fetch
09:10:26.619:XRP5:INFO:RPCManager:transaction 0 arrived after 77ms
09:10:26.629:XRP5:DEBUG:RPCManager:Result string for transaction 0: "<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>2</endRow>
<totalRows>2</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_pharma_company_name>DrugCompany1</vv_pharma_company_name>
  </record>
  <record>
    <vv_drug_id>2</vv_drug_id>
    <vv_pharma_company_name>DrugCompany2</vv_pharma_company_name>
  </record>
</data>
</response>
"
09:10:26.638:XRP5:INFO:RPCManager:rpcResponse(unstructured) results -->"<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>2</endRow>
<totalRows>2</totalRows>
<data>
  <record>
    <vv_drug_id>1</vv_drug_id>
    <vv_pharma_company_name>DrugCompany1</vv_pharma_company_name>
  </record>
  <record>
    <vv_drug_id>2</vv_drug_id>
    <vv_pharma_company_name>DrugCompany2</vv_pharma_company_name>
  </record>
</data>
</response>
"<--
09:10:26.659:XRP5:INFO:ResultSet:isc_ResultSet_3:Received 2 records from server
09:10:26.675:XRP5:DEBUG:ResultSet:isc_ResultSet_3:full length set to: 2
09:10:26.691:XRP5:DEBUG:ResultSet:isc_ResultSet_3:integrating 2 rows into cache at position 0
09:10:26.706:XRP5:INFO:ResultSet:isc_ResultSet_3:cached 2 rows, from 0 to 2 (2 total rows, 2 cached)
09:10:26.723:XRP5:INFO:ResultSet:isc_ResultSet_3:Cache for entire DataSource complete
09:10:26.739:XRP5:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:10:26.755:XRP5:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:10:31.942:INFO:ResultSet:isc_ResultSet_5:setCriteria: filter criteria changed, invalidating cache
09:10:31.962:INFO:ResultSet:isc_ResultSet_5:Invalidating cache
09:10:31.984:DEBUG:ResultSet:isc_ResultSet_5:getRange(0,1), cache check: 0,37 firstMissingRow: 0 lastMissingRow: 37
09:10:32.001:DEBUG:ResultSet:isc_ResultSet_5:getRange: guessing forward scrolling
09:10:32.019:INFO:ResultSet:isc_ResultSet_5:getRange(0, 1) will fetch from 0 to 75
09:10:32.036:INFO:ResultSet:isc_ResultSet_5:fetching rows 0,75 from server
09:10:32.055:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Finding records that match your criteria...
09:10:32.073:INFO:RPCManager:sendQueue[1]: 1 RPCRequest(s); transport: xmlHttpRequest; target: /som/xml_sample_log_drug_name
09:10:32.092:DEBUG:RPCManager:XMLHttpRequest GET from /som/xml_sample_log_drug_name with fields: {vv_operation_type: "fetch"} full URL string: /som/xml_sample_log_drug_name?vv_operation_type=fetch
09:10:32.123:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 10) satisfied from cache
09:10:32.154:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 25) satisfied from cache
09:10:32.181:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 25) satisfied from cache
09:10:32.220:XRP0:INFO:RPCManager:transaction 1 arrived after 129ms
09:10:32.240:XRP0:DEBUG:RPCManager:Result string for transaction 1: "<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>0</endRow>
<totalRows>0</totalRows>
<data>
</data>
</response>
"
09:10:32.264:XRP0:INFO:RPCManager:rpcResponse(unstructured) results -->"<response>
 <status>0</status>
<startRow>0</startRow>
<endRow>0</endRow>
<totalRows>0</totalRows>
<data>
</data>
</response>
"<--
09:10:32.295:XRP0:INFO:ResultSet:isc_ResultSet_5:Received 0 records from server
09:10:32.315:XRP0:DEBUG:ResultSet:isc_ResultSet_5:full length set to: 0
09:10:32.336:XRP0:DEBUG:ResultSet:isc_ResultSet_5:integrating 0 rows into cache at position 0
09:10:32.357:XRP0:INFO:ResultSet:isc_ResultSet_5:cached 0 rows, from 0 to 0 (0 total rows, 0 cached)
09:10:32.377:XRP0:INFO:ResultSet:isc_ResultSet_5:Cache for entire DataSource complete
09:10:32.398:XRP0:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:10:32.434:RDQ3:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:10:32.475:RDQ1:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:10:42.045:INFO:ResultSet:isc_ResultSet_3:setCriteria: filter criteria unchanged
09:10:42.067:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:10:42.097:DEBUG:ResultSet:isc_ResultSet_3:getRange(0, 1) satisfied from cache
09:10:47.629:INFO:ResultSet:isc_ResultSet_5:Local filter applied: 0 of 0 records matched filter:{vv_pharma_company_name:"DrugCompany1"}
09:10:47.656:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:10:47.680:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list
09:10:47.714:RDQ6:DEBUG:ResultSet:isc_ResultSet_5:getRange(0, 0): returning empty list

Why doesn’t it go back to the server to get values in the second example? Thanks.

Haven’t looked closely enough to be sure, but most likely, it believes it has a full cache because it got an empty result with no filter criteria. You could avoid this by sending some of kind of special token indicating no selection. Or you could disable the second field until the first field has a value.