I've got the following simple comboBox in my page.
<rich:comboBox value="#{groupConfig.group}"
styleClass="userCombo"
filterNewValues="false"
directInputSuggestions="true">
<f:selectItems value="#{
workflowConfigCtrl.groupsFor(groupConfig,appNode.approvalTier)
}" />
</rich:comboBox>
It works marvellously, but sadly it allows input of values that are not part of the suggestionList (which makes sense, as I enabled direct text input.
I want direct text input enabled, so that the user can use the suggestion list to quick filter (from a huge group list which can comprise several 100 groups).
At the same time i don't want the user to enter a value that is not in the list. The current approach checks when the user saves the whole form. Is there any way to limit it earlier?
I tried to do it using a javascript onblur= handler, but i can't find the place where the selectItem list is saved in the dom.
You can access the comboBox list in javascript by using
#{rich:component('myComboBoxId')}.comboList.itemsText
and/or
#{rich:component('myComboBoxId')}.comboList.itemsValue
and then use jQuery.inArray()
to verify if the item is in the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With