Question

I have a <af:selectOneChoice> with immediate=true and autoSubmit=true, and a <af:inputText> with rendered=#{bean.someValue}, required=true and immediate=true.

When I select choice 1 from <af:selectOneChoice> the bean.someValue is false, therefore <af:inputText> is not rendered. And when I select choice 2 from <af:selectOneChoice> the bean.someValue is true, therefore <af:inputText> is rendered.

Test Case: Initially, choice 1 is selected in <af:selectOneChoice>, therefore <af:inputText> is not rendered. As I select choice 2 in <af:selectOneChoice>, <af:inputText> is rendered and it becomes visible. When I again select choice 1 in <af:selectOneChoice>, the page throws and error Enter a value, but the value of <af:selectOneChoice> changes to choice 1.

In this case, I want that the value of <af:selectOneChoice> should revert back to choice 2.

How to do this?

No correct solution

OTHER TIPS

I'm a little confused by your test case, so you're saying when the inputText is empty, you change the selectOneChoice to choice 1, and since your inputText "required" attribute is set to true, so ADF throws an visual error remind you to "enter a value", till now everything is what you expected, right? But although the error msg pops out, the selectOneChoice still got to change to choice 1, this is the problem right?

I guess to prevent the selectOneChoice value to change to choice 1 in the error case, you can add some verification code in the valueChangeListener of the selectOneChoice component from the back bean, to decide whether the value should be changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top