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}; //
}
}
]
});