prompt in ComboBox control in Flex.

When we are working on ComboBox control in Flex we give a default value to it so that the user using the Control is Prompted with some message. The default value like “select a product” …. something like that for the user Interface to select a value from the list. So to set this we can use a existing property in the ComboBox control called “prompt”.Example is given below.

<mx:ComboBox x=”89″ y=”299″ width=”240″ prompt=”Select Product..” labelField=”@PRO”  dataProvider=”{arrColl}”  id=”cmbStatus” ></mx:ComboBox> 

As you can see the property usage in the control and the dataProvider is the ArrayCollection [An Example].

Enjoy the new Property in ComboBox control. And Enjoy the code.

prompt property in ComboBox control in Flex.

This image shows the property.

Advertisements

10 Responses to prompt in ComboBox control in Flex.

  1. José Carlos Fonseca says:

    Hello,

    Imagine your code with the change on the prompt:

    It’s possible use the string “All” as a value if i don´t change anything in the combobox??

    Thanks!!

    José Carlos Fonseca
    FAFE – PORTUGAL

  2. manish says:

    But after selecting a product the prompt value ‘Select Product..’ disappears then what to do

    • kumargandhi says:

      After selecting a value , that value is highlighted on the Combobox, thats the feature of it., if you want to reset it, then assign -1 as the selectedIndex to the Combobox.

      regards,
      kumar.

  3. […] prompt in ComboBox control in Flex. […]

  4. Betsy Olvey says:

    I really find this a interesting subject. Never looked at this subject in this way. If you are going to create some more articles about this subject, I will be back soon!

  5. santosh poduri says:

    Gandhi, Nice to see your blog ra. Long time . I have a question ra, i had a Combo Box, with a prompt(select a value). i want to change this value dynamically, in the sense, suppose the combo box is getting filled, the prompt says loading,if the values are not filled then it says the (select a value). So any idea regarding this.
    I am new to Flex .

    • kumargandhi says:

      Hi Santosh,

      In script we can change the prompt value of the combobox, like comboboxID.prompt=”select a value”; dunamically.So you working on flex??.

      regards,
      kumar.

      • santosh poduri says:

        I tried the comboboxID.prompt=” “, But i am getting error in my action script. The combo value is defined in another file say wizard.mxml, how an i use that combo box, toc hange dynmically in another file tool.mxml. i tried like wizard.comboboxID.prompt, but no result.

        I am working on .NET , as apart of my project now working on flex.

      • kumargandhi says:

        I assume you want to change the prompt value of a combobox in wizard.mxml from tool.mxml before loading that wizard.mxml component right, then this is my solution, use getter/setter methods for promt in wizard.mxml and assign that to the combobox prompt, so while in tools.mxml before loading/popping wizard.mxml change the prompt using the setter method,like below.

        //in tools.mxml
        var wizardinstance:Wizard=new Wizard();
        wizardinstance.setComboBoxpromtp=”Select a value”;
        //here pop that wizard or change view to wizard//

        //in wizard.mxml in combobox component tag use
        prompt={getComboBoxPrompt}

        so now if you open the wizard.mxml(through the instance we created above) we can see the change.

        drop me your mail id, i will send some code snippet.

        regards,
        kumar.

  6. santosh poduri says:

    Thanks, for the sugegstion, i will try it, my email id is santu_589@yahoo.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: