Richfaces: limit rich: comboBox for list values

I have the following simple combo box on 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 wonderfully, but unfortunately, it allows you to enter values ​​that are not part of the list of sentences (which makes sense, since I allowed direct text input.

I want to enable direct text input so that the user can use the list of sentences for a quick filter (from a huge list of groups, which can contain several 100 groups).

At the same time, I do not want the user to enter a value that is not in the list. The current approach checks if the user saves the entire form. Is there a way to limit it earlier?

I tried to do this using the javascript onblur = handler, but I cannot find the place where the selectItem list is stored in dom.

+5
2

comboBox javascript,

#{rich:component('myComboBoxId')}.comboList.itemsText

/

#{rich:component('myComboBoxId')}.comboList.itemsValue

jQuery.inArray(), , .

+3

DOM, , .

<rich:comboBox value="#{groupConfig.group}"
               id="UniqueID"
               styleClass="userCombo"
               filterNewValues="false"
               directInputSuggestions="true">
  <f:selectItems value="#{
    workflowConfigCtrl.groupsFor(groupConfig,appNode.approvalTier)
  }" />
</rich:comboBox>

document.getElementById("UniqueID") DOM.

+2

All Articles