Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ComboBox related conditional

New Here ,
Mar 06, 2013 Mar 06, 2013

Hi there!

Prior to trigger an action with a button I want to warn user he/she must select an item in a ComboBox named "CBSCH".

Item at index 0 of the ComboBox has no data attached and label is "Please, select a school".

Example;

searchBtn.onRelease = function() {

    var school = CBSCH.selectedIndex;

    if (school = 0) {

        errorMsgFld.html = true;

        errorMsgFld.htmlText = "<font color='#FF0000'>Please, select a school.</font>";

    }

    else {

        searchFct();

    }

};

This doesn't work. What's wrong.

I also used selectedItem.data = ""

Wrong too.

I thank you in advance for your help!

TOPICS
ActionScript
559
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 06, 2013 Mar 06, 2013

use the double equal (==) to test for equality:

searchBtn.onRelease = function() {

    var school = CBSCH.selectedIndex;

    if (school == 0) {

        errorMsgFld.html = true;

        errorMsgFld.htmlText = "<font color='#FF0000'>Please, select a school.</font>";

    }

    else {

        searchFct();

    }

};

Translate
Community Expert ,
Mar 06, 2013 Mar 06, 2013

use the double equal (==) to test for equality:

searchBtn.onRelease = function() {

    var school = CBSCH.selectedIndex;

    if (school == 0) {

        errorMsgFld.html = true;

        errorMsgFld.htmlText = "<font color='#FF0000'>Please, select a school.</font>";

    }

    else {

        searchFct();

    }

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 06, 2013 Mar 06, 2013

PERFECT!

It works nice and smooth...

Thank you very much, kglad.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2013 Mar 06, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines