Invalid values in comboBox

Hi all,
I'm using the comboBox widget, I need the filter propery but when user enters an invalid value into the input field I have to raise an error, how can I do that?
Is there any way to check if a comboBox contains a value?

Best regards
David

Invalid values in comboBox

Hi David,
Could you try to check the value in the change event ?
~Yudi

Hi Yudi, Yes, I could try it

Hi Yudi,
Yes, I could try it but I don't know how.

<e:handler event="change">
    var value=this.getProperty('value');
    // and now, how could I check wether my combo contains "value" or not???
</e:handler>

Thanks yudi
David

Hi David, It can be check if

Hi David,

It can be check if the value is null or empty then give some message or something else.

if(this.getProperty('value')==""){
      alert('your message');
    }

It is also possible to use validation bf:required or b:dataType with your own schema for this.For more info , please have a look http://demo.backbase.com/explorer/#|examples/contentValidation.xml
<b:comboBox bf:required="true" b:dataType="myValidation:country">
   <b:comboBoxOption>Afghanistan</b:comboBoxOption>
   <b:comboBoxOption>Albania</b:comboBoxOption>
</b:comboBox>

~yudi

Yes, I can know if the value

Yes, I can know if the value is null or not, but what I want to know is if the value typed by user is one of the comboBoxOption. Because of filter="true", the user can type into the input a value not allowed (Only are allowed the values in the comboBox), and in this case I have to raise a message.

comboBox doesnot match any filter value

Hi David,

The comboBox will do filtering everytime the user type a letter in the inputText. And the method filter actually do filter and set bMatches variable.

You can access the javascript property which is 'this.__bHasMatches'

Next, you can check its value..whether it matches any value or not, if it does not match anything you can raise a message.

you can put this value in 'change' or in 'keyup' or in 'keydown' handler.

Hope this helps,

Andys

OK andys, this is what I

OK andys, this is what I wanted.

Thanks and regards
David