"if" related to ComboBox visible or not

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Germaris
    New Member
    • Jan 2008
    • 18

    "if" related to ComboBox visible or not

    Hi there!

    On my form I have two ComboBoxes.
    The first displays a list of countries.
    The second one, if the country selected in the first ask for, displays a list of states, provinces or republics, etc depending on the country selected.
    This second ComboBox appears or disappears driven by listeners.
    At this point, the combination of the two ComboBoxes works perfectly well.

    My problem is:
    If the first ComboBox (countries) ask for a selection of the administrative division, the user MUST select it in the second one.
    This is mandatory for the success of the registration of the order.
    In order to warn the user in case he/she didn't select the administrative division, I have tried different if/else statements based on .visible or ._visible = true or CB_TWO.selected Item.label or CB_TWO.selected Item.data statements but no one works.

    How can I proceed to solve this question?

    Many thanks in advance for indicating the right way!

    Best regards,
    Gerry

    Here is the code:

    Code:
    countryFct = function () {
    	if ((CB.selectedItem.label == "") || (CB_TWO.selectedItem.label == "")) {
    		_root.instructFld.text = "Server is down.";
    	}
    	else {
    		if (CB.selectedItem.label == "Select your country...") {
    			_root.instructFld.text = "Please select a country.";
    		}
    		else {
    			_root.countryFld.text = CB.selectedItem.data;
    			if (CB_TWO.selectedItem.label == "Select...") {
    				if (CB_TWO.selectedItem.data == undefined) {
    					_root.stateFld.text = ", ";
    					_root.instructFld.text = "Please select a state.";
    				}
    				else {
    					_root.stateFld.text = (", " + CB_TWO.selectedItem.data);
    				}
    				calculationsFct();
    			}
    			else { 
    			    _root.stateFld.text = (", " + CB_TWO.selectedItem.data);
    			}
    		}
    	}
    };
Working...