Conditional Dropdown options

I am having difficulty with my code on a user information profile update page I am trying to code. What I want is to disable two input-dropdown boxes until their ‘parent’ dropdown selection is made. It wasnt enabling onChange so I changed this to onClick.

The other issue I am having is the conditional dropdown I am trying to code for the Industry/Trade selections is not working for the second selection. It creates the unique list for the first input but not the second. Console log is saying: TypeError: Cannot read property ‘map’ of undefined on line 45, which is: var titlesOnly = items.map(item => item.trade);

My code for this is:

import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;

$w.onReady( function () {
populateIndustry();
populateTrade();
});

function populateIndustry(){

wixData.query( "Industry" ) 
.limit( 1000 ) 
.find() 
.then(results => { 

var uniquelist = createUniqueList(results.items);
$w( “#iptIndustry” ).options = buildOptions(uniquelist);
})

function createUniqueList(items){
var titlesOnly = items.map(item => item.industry);
titlesOnly.sort();
return [… new Set(titlesOnly)];
}

function buildOptions(uniqueList){
var uniqueListFinal = uniqueList.map(curr => { return {label:curr, value:curr}; });
return uniqueListFinal;

} 

}

function populateTrade(){

wixData.query( "Industry" ) 
.limit( 1000 ) 
.eq( 'industry' ,$w( "#iptIndustry" ).value) 
.find() 
.then(results => { 

var uniquelist = createUniqueList(results.items);
$w( “#iptTrade” ).options = buildOptions(uniquelist);
})

function createUniqueList(items){
var titlesOnly = items.map(item => item.trade);
titlesOnly.sort();
return [… new Set(titlesOnly)];
}
console.log(createUniqueList())

function buildOptions(uniqueList){
var uniqueListFinal = uniqueList.map(curr => { return {label:curr, value:curr}; });
return uniqueListFinal;

} 

}

export function iptIndustry_click(event) {
populateTrade();
$w( “#iptTrade” ).enable();
}

export function iptState_click(event) {
$w( “#iptRegion” ).enable();
}

Work with CONSOLE-LOGs and you will be able to find your issue.