Werner Punz wrote:
Richard Wallace wrote:
Werner Punz wrote:
Richard Wallace wrote:
Hello again,
I'm trying to figure out how, if it's possible to add form
elements, like text fields, when a user clicks an add button
without having to have the page resubmit.
Only by using javascript, but without javascript no.
That is a limit caused by the beast which is called html.
With javascript you can do it by altering the dom
tree.
I understand that, but how do you have JSF pickup the new element(s)
when restoring state when the form is submitted?
To my knowledge by adding child elements to an element binding in
the backend bean.
JSF basically builds an element tree internally, and you basically can
access this tree over various methods. - One being the element bindind
mechanism.
During the rendering phase, the elements then are rendered into the
target (mostly html)
Thus you cann add and remove those elements by tinkering with the
element tree in your backend bean.
Ok, but how should I "tinker" with the element tree? I'm guessing AJAX
will need to come into play. But how do I get access to the element
tree? And exactly how should I manipulate it? I'm guessing there's no
ready to go methods already in the JSF APIs to accomplish this, are there?
Rich