Reputation: 45
I have a fieldset with some selectonemenus on my jsf page. I clone the fieldset using jquery on click of a link, similar to 'add another row' (logic similar to: Using jQuery to dynamically add form fields (or fieldsets) based on a dropdown box value), I can add infinite fieldsets, now how do I bind or get the values of this dynamically generated form content on my controller. I use f:ajax to submit the form. I checked this : How do I create form controls dynamically with DHTML and deal all those with JSF?, it says non-trivial, is there any simple way of getting these values on my JSF. Thanks.
Upvotes: 0
Views: 1656
Reputation: 1108537
You need to either "clone" the fieldset by JSF instead of jQuery (<ui:repeat>
or <h:dataTable>
is helpful here), or to drop JSF and use a request based MVC framework instead.
If you don't want to drop JSF and want to stick to the jQuery way for some reason, then you'll have to rewrite a lot of boilerplate code yourself which does basically the same job as JSF is doing under the covers in order to collect the submitted values, converting/validating them, updating the model values and invoking any business actions.
Upvotes: 1