I'm having a weird problem with JSF with A4J. I have a form with 2 <h:selectonemenu> where we need to select a value from the first in order to populate the next with choices. I implemented this by adding an <a4j:support> tag inside the <h:selectonemenu> tag. So far, this part is working fine as the 2nd h:select.. gets populated with data. The problem however is that after we submit the form again (1st submission was during ajax event), I get a validation problem stating that the value for the 2nd h:select.. is not valid. After debugging the application, I found out that the error was because the form was never mapped again to the backing bean. I'm surprised why this is the case since I was under the impression this was supposed to be done automatically by JSF. (I'm very close with quitting on JSF)
At first I thought this might be an issue with a4j, but I experimented on another implementation where the page would reload upon selection from the 1st h:select... (no more ajax) to populate the options for the 2nd h:select.. and I still encounter the same problem.
My theory is that upon the 1st submission (populating 2nd h:select...), the page somehow got screwed up and caused the form not to submit properly. But I'm very much at a loss as to how and why this happens.
Hoping someone has encountered the same thing and found a solution.
Well, I have also implemented the same thing but in a different way. I used a value change listener to make a backend call whenevr the first dropdown changes. In the valuechangelistener method, I populated the values in the 2nd dropdown. On completion, I rerenderd the new dropdown.
See if you can use this!
Good night. Drive safely. Here's a tiny ad for the road: