Skip to Content
avatar image
Former Member

How to check if a dropdown element is selected or not

Hi all

I have a dropdownbykey UI element .it's getting value from EJB's.I want to perform a check to find if user has selected any element from it or not when I press a Submit button.Note that it is showing blank innthe dropdown initially.

Thanks

Ananda

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 03, 2006 at 11:31 AM

    Check the value of the context attribute to which the "selectedKey" property of the drop-down list is bound.

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 03, 2006 at 11:32 AM

    Hi Ananda,

    In the event handler of the button check the value of attribute bound to the selectedkey property UI element.Since it is null initially you can check its value

    Regards

    Rohit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 03, 2006 at 11:33 AM

    Hello Anandha,

    Define a new context attribute of type say boolean and set its value to true in the onAction event of the dropdown.When the Save button is clicked check if the attribute is true/false to get the actual state, i.e, if the user has selected a value or not.

    Hope this helps.

    Bala

    Add comment
    10|10000 characters needed characters exceeded