• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF with Javascript

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In my application I have two list boxes (selectOneListbox), one shows Available Items and the other shows Selected Items. I use javascript to transfer items between the two list boxes. When I click on the commandButton, the desired action method is not executed, rather the list boxes get reset to their previous state (i.e. all the items from Selected List go back to the Available List.) And when I click on the commandButton again immediately, then the action method is executed.

My doubt here is does JSF not like javascript performing a task and hence resets it when we try to submit the form. Any suggestions to work around this issue, and to be able to submit the form when I have items in Selected List and to make those items available in the backing bean. Thanks for your responses.

Amar
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whenever you change the options of a dropdown at the client side, you need to change this at the server side too. This because of the fact that JSF validates the selected options against the list of options as it was in initial request.

I suggest you to take a look for an ajaxical component library such as RichFaces. They have a rich:pickList component which suits your needs. Here are some useful links about that:
http://jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/pickList.html
http://livedemo.exadel.com/richfaces-demo/richfaces/pickList.jsf
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic