I have a strange error
I created 2 combo boxes
the first (cadcri_est) does a search and loads the list of states from an nsf base, like the code below.
The second combo box (cadcri_cid), reads the first and does another search, bringing the list of cities.
in "values" of cadcri_cid I have 1st do
return "";
2nd after
var dbname1 = session.getServerName() + "!!" + "estmun.nsf";
var categoryComp = getComponent("cadcri_est");
if ((categoryComp) == null) return "";
var category = categoryComp.getValue();
if (category == "") return "";
var res = @Unique(@DbLookup(dbname1, "vestmun", category, 2));
document1.replaceItemValue("cadcri_cid", "");
return res;
And in the onchange event of the 1st combo box, I do a Partial Update on cadcri_cid
The problem happens if the user selects the state, the city and then tries to change the state again. in this case, the second combo box disappears and only comes back with an update on the page. If he first clears the selected city (the first item in the list is ""), then he can change the state and the list of cities loads normally.
Does anyone have an idea how to resolve this?
I tried loading "" (blank) into the values of the cadcri_cid combo, before reloading the list of cities (apparently this works when done manually), but it didn't work.
There are a few issues in your code:
Try to avoid looking up the components. Always use data binding. Either to a document or a scope variable.
Don’t return „“ as value when the category isn’t selected, but something like „- Select region first-„
Let us know how it goes