In the above form 'Airports' input field datalist is populated by lookup from a database table based on 'Travel Type' (Domestic or International).
Problem is sometime when 'Travel Type' field option is changed 'Airports' datalist is not getting refreshed. For example in the above case I changed travel type from domestic to international but airports input field shows only value only with in domestic cities (Australia). Where as if I refresh the form and try again this it loaded correctly. So the issue is happening randomly.
Here is how lookup defined -
'Fly From Filter' is an hidden input field that holds value of Travel Type radio button (Domestic or International). Every time Travel Type changed 'Fly From Filter' field gets updated and in code I am triggering the change event on 'Fly From Filter' field expecting it to refresh lookup data.
$('.hf-fly-from-filter input').val($('.travel-type input').val());
$('.hf-fly-from-filter input').trigger('change');
But it is sometime working and sometimes not. Is there any way that I can ensure or wait for the lookup to refresh Airports datalist every time travel type option is changed. Appreciate any help on this.