Forums Register Login

JSF with Javascript

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1034 times.
Similar Threads
Dependent drop down boxes with javascript
valueChangeListener
"Select Boxes" - Same Name
valueChanged question/problem
JSF and JQuery - error with selectOneListBox
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 08:57:47.