473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

"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.selectedItem.label or CB_TWO.selectedItem.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:

Expand|Select|Wrap|Line Numbers
  1. countryFct = function () {
  2.     if ((CB.selectedItem.label == "") || (CB_TWO.selectedItem.label == "")) {
  3.         _root.instructFld.text = "Server is down.";
  4.     }
  5.     else {
  6.         if (CB.selectedItem.label == "Select your country...") {
  7.             _root.instructFld.text = "Please select a country.";
  8.         }
  9.         else {
  10.             _root.countryFld.text = CB.selectedItem.data;
  11.             if (CB_TWO.selectedItem.label == "Select...") {
  12.                 if (CB_TWO.selectedItem.data == undefined) {
  13.                     _root.stateFld.text = ", ";
  14.                     _root.instructFld.text = "Please select a state.";
  15.                 }
  16.                 else {
  17.                     _root.stateFld.text = (", " + CB_TWO.selectedItem.data);
  18.                 }
  19.                 calculationsFct();
  20.             }
  21.             else { 
  22.                 _root.stateFld.text = (", " + CB_TWO.selectedItem.data);
  23.             }
  24.         }
  25.     }
  26. };
Mar 3 '08 #1
0 1852

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: LRW | last post by:
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or,...
6
by: Fabrice Régnier | last post by:
Hi ;) Everything is in the title. the prob is "boo" is displayed ! Can you believe it ? Thanx for anyone who can help me. fabrice.
1
by: Mark Richards | last post by:
The solutions for the following problems seems to be simple but I did not found a (convenient) solution: Assume we have a number of elements of the same type under a common parent e.g. <person...
5
by: kmunderwood | last post by:
I am trying to combine "if match=" and "when test" I am a newbie, and have made both work separately, but I can not seem to combine them. This is my xml("index.xml")page(I can not change this,...
40
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the...
145
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two...
2
by: marsarden | last post by:
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if
33
by: Snis Pilbor | last post by:
With the "as if" rule in play, doesn't that effectively render the "register" keyword completely useless? Example: I make a silly compiler which creates code that goes out of its way to take a...
0
by: jack | last post by:
IF you want to meet your old school mate's & college mate's of your life there is a chance, just enter school or college details in the below site ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.