Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem in submitting values to be mapped to backing bean

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day,

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.
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic