I want to build a form that dynamically changes the components visible depending on the state of other components.
For example... There are some text boxes and some check boxes, and if the user activates a certain check box, a bunch of other input elements should appear.
Can I do this with JSF 2.0 + Tomahawk or do I have to get another library to do this? And how can I do it? This won't work without AJAX, will it?
Thanks in advance!
Ajax is a convenient way to do this and JSF 2.0 comes with ajax bundled.
Here is an example:
The
h:panelGroup
will be rendered when "yes"-option is clicked inh:selectOneRadio
(itemValue == 1). Initially it is 0 (set in the bean "a7").The
h:panelGroup
acts as wrapper since you can only update components with ajax that are actually rendered on the page (h:outputText
andh:inputText
are initially not displayed).