This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF and JQuery - error with selectOneListBox  RSS feed

 
amar mahtani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application I have two list boxes (selectOneListBox) one representing available values (pre populated) and one representing selected values (empty). Both list boxes are have the f:selectItems tag which is bound to a variable in the backing bean. When I choose a value from the Available list and click on the "add" button, I use JQuery to transfer the selected item from the Available list to the Selected List. All this works fine.

However when I click on the save button (h:commandButton) my application goes through the various life cycle phases and when it reaches the process validation phase, it performs a SelectItemsIterator on both Lists but fails on the Selected List with the error "NoSuchElementException()" since it was initially empty. I initialized the List Boxes as follows.




I have tried initializing the Map to have an empty key and value pair, but when I run the application,
the list item contains an empty entry, and that is also allowed to be moved between lists when I add to or remove from the Selected List.

I would like to know if there is a way to bypass the list validation.

All I require is that After I transfer the Items from Available List to Selected List and hit submit, I need to be able to access the List items in the backing bean. If you have a work around to my problem stated above or if you have a completely different approach in handling this problem I would be really happy to hear from you. thanks for your replies in advance.

Regards,
Amar Mahtani
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66184
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this for information on why using phrases like "urgent" can cause your post to be ignored. I have removed it from your subject for you.
 
amar mahtani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear for the suggestion.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!