Hello
Let me try to explain the situation: I have a few dependant Lookup fields (lets say Country - Province - City - Street).
- When I select a Country first, only Cities, Streets and provinces in that country are shown (dependant lookup and provinces/streets via FetchXML)
- When I select a Province, only Cities and streets of that province are shown in the view of the City and Street lookup, Country is filled in automatically based on the province (1:N)
- When I Select a City, the Country and Province are automatically filled based on the City and the Street Lookup shows the streets in that City.
- When I Select a Street, Country, Province, City are filled in automatically.
I'll try to explain my problem even my English isn't that great: A User here needs to have the functionality to keep changing those lookup values. Now the problem is, when all Lookup fields are filled in and the user selects a Province, I want to set the values of City and street on null (same for Country -> Province/City/Street on null // City -> Street on null). This means a User selects a Province -> OnChange province is called -> Clears City and Street -> Fills in Country automatically (as mentioned before) -> On Change Country is fired -> Clears Province (not wanted), City,Street,...
Small Example Explained:
handleOnChangeProvinceAttribute: function () { var province= this.getSelectedProvince(); this.updateView("City",province); this.updateView("Street",province); //Update Country by selected Province (1:N) -> Calls OnChange Country (= handleOnChangeCountryAttribute) this.getAttribute("Country").setValueByProvince(province); //I Need to empty Street and City this.setValueAsNull(["City","Street"]) } handleOnChangeCountryAttribute: function () { var country= this.getSelectedCountry(); this.updateView("Province",country) this.updateView("City",country); this.updateView("Street",country); //I Need to empty Street and City & PROVINCE :( this.setValueAsNull(["City","Street","Province"]) }
I really don't know how I should handle this problem (that is why I came here). I am not a Javascript Expert either, but I need some input what the possibilities are to solve a problem like this.