selectOneMenu ajax events

后端 未结 4 1069
臣服心动
臣服心动 2020-12-03 02:45

I am using an editable primefaces selectOneMenu to display some values. If the user selects an item from the List a textarea should be updated. However, if the user types so

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 03:08

    You could check whether the value of your selectOneMenu component belongs to the list of subjects.

    Namely:

    public void subjectSelectionChanged() {
        // Cancel if subject is manually written
        if (!subjectList.contains(aktNachricht.subject)) { return; }
        // Write your code here in case the user selected (or wrote) an item of the list
        // ....
    }
    

    Supposedly subjectList is a collection type, like ArrayList. Of course here your code will run in case the user writes an item of your selectOneMenu list.

提交回复
热议问题