0

I have read some existing posts about this. None suits my case.

In my program, I used bunch of h:selectOneMenu and they all work just fine. Except that for this one specific h:selectOneMenu, if I choose one specific option, I get a "taskForm:taskDropDown: Validation Error: Value is not valid"

The code is:

<h:selectOneMenu id="taskDropDown" value="#{fetchQuery.taskName}">
    <f:selectItem itemValue="" itemLabel="Select.." />
    <f:selectItems value="#{getInitiative.allTaskNames}" var="t"
        itemLabel="#{t}" itemValue="#{t}" />
    <f:ajax listener="#{getInitiative.taskChosen()}" immediate="false" />
</h:selectOneMenu>

Here, the "getInitiative.allTaskNames" is an array of String. This is what it contains when I check the debug window:

[Identify appropriate tests/coverage, Build scripts in Selenium for identified UI tests, Build scripts identified in SOATest Service tests, Identifiy appropriate timing for execution of scripts, Identifiy appropriate reporting metrics , Modify dashboard to run scheduled tests, Identify new database to store common test results, Design new web UI for IMPACT automation , Implement reporting into the database, Build new web UI for IMPACT automation , ytugjkh]

If I choose the option "Build new web UI for IMPACT automation ", the error occurs and the ajax part is not evoked.

Usually the error occurs because of one of two reasons:

"equal" method is broken for the object. I am using String, so the equal() should be ok.

The value of the data is changed. Which is probably not the case either, because the array is only populated for once and no longer changed. Moreover, other options in the array are just working fine.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
bookmonkie
  • 439
  • 6
  • 21

1 Answers1

0

This may occur when the selected value is not in the list of the values present in the selectOneMenu. It may happen when the internal coversion of that value is different, like it might be containing unwanted characters while storing that data in DataBase. Just open JSF page in debug mode( which shows two attribute values submittedValue and value which is causing error) and find which value is causing the issue and change the value again manually in database and check it. It may work.