Hi, I've been testing Plumsail Forms and had been trying to work on doing cascading look-ups. I just can't seem to make it work. I'm totally new to Plumsail and close to giving up.
I am to do a look-up where if you select 'Region', countries under that region will populate my 'Country Office' field.
I setup 'Country Office' as
The script I used;
fd.spRendered(function() {
fd.field('Country Office').ready().then(function() {
function filterLookup(v){
// getting the selected Category (0 if nothing is selected).
var categoryId = 0;
if (v) {
categoryId = isNaN(v) ? v.LookupId : v;
}
if (categoryId) {
// setting filtration
fd.field('Country Office').filter = 'Region eq' + categoryId;
} else {
// resetting the filtration
fd.field('Country Office').filter = null;
}
fd.field('Country Office').widget.dataSource.read();
}
//filter Country Office when form opens
fd.field('Region').ready().then(function(field) {
filterLookup(field.value);
});
//filter Country Office when Region changes
fd.field('Region').$on('change', function(value){
filterLookup(value);
fd.field('Country Office').value = null;
});
});
});
What am I doing wrong? Total newbie here